What's New Here?


Choosing a leader like an agilist

The leader as a captain I recently read Petri Kainulainen’s article on sharing leadership among team members and I am on the same wavelength in this regard, since the Agile methods emphasizes the importance of “motivated individuals, who should be trusted”. While a team leader could be regarded as a reminiscence of the old rigid organization structures, I still see many benefits of having such a captain. When it comes to improving my people skills, I like to get inspired by other domains of activity that have been struggling with the very same challenges for decades. Think about the greatest sport teams, where all team members are stars, and yet they always have a captain for:the captain is the role-model for every team member he leads by example he always mediates conflicts, knowing that prevention is always better than curing he welcomes and facilitates new team members integration he never loses his temper in times of trouble, he is the voice of the team he is constantly goal-oriented, making sure the team is on the right trackThe leader is nominated by the team But a great captain is always chosen by the team members. That’s the most natural way of nominating a leader and a leader doesn’t have to be imposed. This is how a team leader should be chosen in our industry as well. Self-organizing teams need to have the power of deciding their leader as well. A leader is not someone who once proved his abilities, but a person who constantly validates his role. The team leader position is always backed by the team members feedback. A good leader is therefore self-reinforced by his positive actions, while a bad leader is simply replaced by someone with better skills. The voting process This is my recipe for choosing a team leader:The team must first understand what a good leader means. The voting is not a popularity contest. The team is always held responsible for their actions and choosing their leader is no different Allow the team members to register for the leader election. If you never wanted to be leader, there is little chance you’d ever become a great one Let everybody vote and explain their reasons for choosing a given team member. Without any reasonable explanation the voting could easily turn into a popularity contest Respect the decision even if the new leader is not who you thought of, in the first placeConclusion We need to trust our teams and respect their opinions. I like this approach since it’s a very good way of spotting leaders that you weren’t aware of. People with leadership potential are rare gems and I always stay open-minded to any method that can bring me the next great leader.   Reference: Choosing a leader like an agilist from our JCG partner Vlad Mihalcea at the Vlad Mihalcea’s Blog blog. ...

Clean SWT Listener Notifcations with SWTEventHelper

Writing tests for SWT based UIs often requires to notify widget listeners programmatically. Unfortunately the code to create, initialize and finally to trigger the event is a bit verbose and distracts from the actual purpose of the test. After writing similar initialization routines a couple of times I came up with a little utility class that avoid these redundancies and make the code somewhat more expressive1 The class is called SWTEventHelper and uses a fluent interface coding style combined with static imports2 as known for example from Mockito. The following snippets demonstrate the usage by a simple example:     public class MouseDownCounter extends MouseAdapter {private int count;public MouseDownCounter( Control control ) { control.addMouseListener( this ); }@Override public void mouseDown( MouseEvent event ) { count++; }public int getCount() { return count; } } Looking at the code of the MouseDownCounter one may consider it necessary to ensure that a mouse down event actually increases the count by one. With the SWTEventHelper a test to do so could look like this: public class MouseDownCounterTest {@Rule public final DisplayHelper displayHelper = new DisplayHelper();@Test public void testMouseDownIncreasesCount() { Composite parent = displayHelper.createShell(); Control control = new Label( parent, SWT.NONE ); MouseDownCounter counter = new MouseDownCounter( control );trigger( SWT.MouseDown ).on( control );assertEquals( 1, counter.getCount() ); }[...] } The test creates a ‘real’ SWT control3 in the build4 section of the test. After that the control is ‘wrapped’ by our unit under test, the MouseDownCounter. The following operate section creates a SWT.MouseDown Event using SWTEventHelper#trigger(int) and the listener that got registered at the Label control is notified via SWTEventHelper#on(Widget). Last but not least the check section ensures that the mouse down has actually increased the counter. The SWTEventHelper furthermore provides a configuration method for each attribute of org.eclipse.swt.widgets.Event. Look at the following line of code to see how to fire an event notification with e.g. a certain Event#keyCode: trigger( SWT.MouseDown ).withKeyCode( SWT.BUTTON1 ).on( control ); As I have used this little helper for over a hundred times now it might be useful for others too. Hence I set up a GitHub gist where you can download the SWTEventHelper code: https://gist.github.com/fappel/9426554 Don’t be shy, give it a try!Expressiveness is of course, at least to some extend, in the eye of the beholder Eclipse offers the possibility to configure content assist with static imports via the favorites preference settings which makes this approach even more comfortable The DisplayHelper reduces typing effort by handling Display related initialization and disposal automatically. You can find a description and a download link in the post A JUnit Rule to Ease SWT Test Setup The test formatting is based on the BUILD-OPERATE-CHECK pattern (Robert C. Martin, Clean Code, Chapter 9, Clean Tests). However in a real world scenario I would probably extract the build section into a separate method  Reference: Clean SWT Listener Notifcations with SWTEventHelper from our JCG partner Frank Appel at the Code Affine blog. ...

Red Hat officially announces release of JBoss BPM Suite 6 and JBoss BRMS 6

Red Hat has just announced general availability of these long awaited products! It takes a large effort to turn the community code into enterprise quality software that customers and end-users can rely on in production with Red Hat support. It is now a great time for current and potential customers to learn about the product, for partners to start engaging with it and learning the nuts and bolts, and for the open source community and Red Hat to receive all sorts of input on these products; all of which turns them into better products to use with the world-class customer service Red Hat has gotten us used to. The new JBoss BPM Suite has a well defined, integral focus on process management and automation. It represents the culmination of an awesome amount of work done by the open source community over many months. It contains not only improvements on existing components, not only a completely redesigned look and feel, but also a set of exciting new features! It’s new, but it maintains backwards compatibility with your previous JBoss BRMS business process and rules project implementations. It also offers with your subscription the world class Red Hat JBoss support of your production environment you are familiar with. JBoss BPM Suite 6 also represents the final phase in the integration of Polymita into Red Hat. That’s why you will find advanced functionalities such as dynamic data and forms modeling. This innovative feature lets you manage those directly from the web interfaces of the tool without coding! Another cool new thing derived from the acquisition is the Business Activity Monitoring. Now you are able to create beautiful dashboards by dragging and dropping on a web interface with all sort of rich graphics that are linked to the processes. In addition, BPM Suite now also includes the entire state-of-the-art BRMS 6 product with its advanced decision management and data analysis capabilities, which is also a separate product in itself that you can continue to use with its own support subscription. So now it’s your turn! Discover how these new products can contribute value to your organization! Download Links:JBoss BPM Suite 6.0 – https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?product=bpm.suite&downloadType=distributions JBoss BRMS 6.0 – https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?product=brms&downloadType=distributionsDocumentation:JBoss BPM Suite 6.0 – https://access.redhat.com/site/documentation/Red_Hat_JBoss_BPM_Suite/ JBoss BRMS Suite 6.0 – https://access.redhat.com/site/documentation/Red_Hat_JBoss_BRMS/Web Pages:JBoss BPM Suite: http://www.redhat.com/products/jbossenterprisemiddleware/business-process/ JBoss BRMS: http://www.redhat.com/products/jbossenterprisemiddleware/business-rules/BPM Example App: A fully functional BPM Example Application is included as part of the downloads.   Reference: Red Hat officially announces release of JBoss BPM Suite 6 and JBoss BRMS 6 from our JCG partner Eric Schabell at the Eric Schabell’s blog blog. ...

Java 8 : What do developers think?

Since Java 8 releasement countdown is starting, Java developers seem certainly ready to get involved. According to a survey in Typesafe, 65% of developers who participated answered that they will be migrating to Java 8 in a 24 months plan, and from them 30% will try to migrate over the next 6 months. 73% of developers who participated are currently working with Java 7, whereas there is a 22% part working still with Java 6. And from those working with Java 6, only 44% are planning to move straight to Java 8. As far as Lamdas are concerned, this new feature of Java 8 is welcome by the Java community, since 83% of developers stated that the lambda expressions and virtual extension methods are the two new features most expected. Devs are also excited with concurency updates (16%) and the new Date and Time API (15%). 48% of devs believe that lambda injection will positively reinforce the adoption of Scala. Java Security has been the big problem where Oracle has focused, and was also the basic cause of the Java 8 release delay. Focusing on better securing the Java platform was the main reason for last year’s decision to delay shipment of Java 8. Oracle seems to have focused on the major bugs, but after all a good job is done, since now an important 59% part of developers believe that these problems have been solved. Oracle has done a good job with the JVM front too, with 98% of users employing it. ...

How to create MySQL DataSource in WebLogic Server

One cool thing about using an application server is that it allows you to create DataSource outside of your application and it can manage it along with thread pool and transaction manager etc. With WebLogic Server, it comes with quite a few built in JDBC drivers such as Oracle Database and MySQL etc ready for your use. Here I will show you how to create a MySQL DataSource.            Login into http://localhost:7001/console On the left menu click Services > Data Sources On the right, click “New” button Enter Name: mysql_ds ; You may optionally give it an JNDI Name: jdbc/mysql_ds; And then select Database Type: MySQL Click “Next” button and then accept default with another two “Next” buttons. Now enter Database Name: test; Host Name: localhost; Database User Name: root; and then the password. Click “Next” and you may optionally test your connection here. Click “Next” and you MUST select an sever as target! Click “Finish”Now you have a DataSource ready to be used by your application on this server. You may access this by either JNDI lookup, or JPA configuration with entity manager injection. TIPS: If you do not pick a server Target in step 8, then your applicatoin will NOT able to access this Data Source! So ensure you have done this step as it’s the easy step to miss.   Reference: How to create MySQL DataSource in WebLogic Server from our JCG partner Zemian Deng at the A Programmer’s Journal blog. ...

Logging or debugging

Debugging is lame. You should debug log. If your code is structured you do not need debug logging. These are two opinions from the two ends of the line. I am, as usually, standing in the middle, and I will tell you why. First of all, there is no principal difference between debugging versus logging. They are just two different implementations of the same thing: observation of your execution engine state in time dimension. Issue with debugging When you debug you step your program forward in time and at any point the execution stops you can examine the value of any variable. The shortage is that you can not step back in time. At some points you realize that you would just like to see what the value of a certain variable was just before some method was called, some object was created or whatsoever happened in the system. What you actually do in such a situation is to restart the code and hoping it behaves deterministic try to catch the execution at the earlier stage that you are interested in. And this is another shortage of debugging. You can not effectively debug a code that does not behave deterministic. And trust me: most bugs behave non deterministic. Issue with loggingWith logs the major issue is different. It is not the time but rather the breadth of states, variables that you can look at is the problem. You insert log statements into your code dumping the values of variables into a log file at a certain point of execution. When you examine the log file you can scroll back and forth. However if you did not print out the value of a certain variable at a certain execution point, there is no way to get it from the log file. The solution is the same as with debugging: execute the code again, this time extended with the new log statements. If, however, you have enough information in your log files, then you will just get enough information to track down a bug even if that is not deterministic. Only ‘if you have’ … Solution: logging all the states all the times? The ideal solution would be to dump all variables into a possibly binary log file at each state of the execution and examine the content of the file afterwards. The examination would essentially look like a debugger, except that the change of the variables comes from the recorded log file instead of from on the fly calculation. It would be like a playback of a recorded execution and as such you could replay it several times. I do not know if there is any tool like that for the JVM. You just can not define what is “each state” effectively in a multi thread execution environment like the JVM is. This is one of the issues. The other thing is that if you’d start dumping the JVM memory after each command (forgetting the issues of multi-thread) it would require enormous amount of bandwidth and disk space. Dreaming about the ideal solution not deliverable is sort of no use. What is the solution that can practically be executed? Practical approach You can debug when it is appropriate. Full stop. You just did that so far, keep doing that. I tend to use log statements even when I debug some code and if the environment allows it I do it on the fly. When I find the root cause of the issue I am hunting I review the log statements and I delete them. They did the job while debugging, they are not needed anymore. At least that was my practice unit I found myself writing log statements that I have already created before. Why? Because fixing one bug does not mean that I have fixed all of them. There is nothing like all bugs fixed. But the log items littered the log file and that just increased the work to find the needed information hunting the next bug. In other words the log file is full of noise and that is why I deleted these items the first place. But for the same reason I could also delete the unit tests that already pass. It would save a lot of time during compilation, wouldn’t it? We do not do that. Summary in one sentence? Log and debug the way it fits you and the issue you are hunting.   Reference: Logging or debugging from our JCG partner Peter Verhas at the Java Deep blog. ...

Java 8 Friday Goodies: Easy-as-Pie Local Caching

At Data Geekery, we love Java. And as we’re really into jOOQ’s fluent API and query DSL, we’re absolutely thrilled about what Java 8 will bring to our ecosystem. We have blogged a couple of times about some nice Java 8 goodies, and now we feel it’s time to start a new blog series, the… Java 8 Friday Every Friday, we’re showing you a couple of nice new tutorial-style Java 8 features, which take advantage of lambda expressions, extension methods, and other great stuff. You’ll find the source code on GitHub. Java 8 Goodie: Easy-as-Pie Local Caching Now get ready for one of the most awesome revelations in this series so far. We’ll show you an easy-as-pie way to implement a local cache using the good old ConcurrentHashMap and lambda expressions. Because, Map now has a new way of a atomically calculating a new value in case a key is absent. Perfect for caches. Let’s delve into code: public static void main(String[] args) { for (int i = 0; i < 10; i++) System.out.println( "f(" + i + ") = " + fibonacci(i)); }static int fibonacci(int i) { if (i == 0) return i;if (i == 1) return 1;System.out.println("Calculating f(" + i + ")"); return fibonacci(i - 2) + fibonacci(i - 1); } Yes. That’s the naive way of doing things. Even for small numbers like fibonacci(5), the above algorithm will print out a huge amount of lines, as we’re repeating the same calculations exponentially: Calculating f(6) Calculating f(4) Calculating f(2) Calculating f(3) Calculating f(2) Calculating f(5) Calculating f(3) Calculating f(2) Calculating f(4) Calculating f(2) Calculating f(3) Calculating f(2) f(6) = 8 What we want to do is build a cache of previously calculated fibonacci numbers. The most straightforward technique is to memoize all values in a cache. Here’s how we build a cache: static Map<Integer, Integer> cache = new ConcurrentHashMap<>(); Done! As mentioned before, we’re using the newly added Map.computeIfAbsent() method to calculate a new value from a source function only if we don’t already have a value for a given key. Caching! And since this method is guaranteed to execute atomically, and since we’re using a ConcurrentHashMap, this cache is even thread-safe without resorting to manually applying synchronized anywhere. And it can be reused for stuff other than calculating fibonacci numbers. But let’s first apply this cache to our fibonacci() function. static int fibonacci(int i) { if (i == 0) return i;if (i == 1) return 1;return cache.computeIfAbsent(i, (key) -> fibonacci(i - 2) + fibonacci(i - 1)); } That’s it. It can’t get any simpler than this! Want proof? We’ll log a message on the console every time we actually evaluate a new value: static int fibonacci(int i) { if (i == 0) return i;if (i == 1) return 1;return cache.computeIfAbsent(i, (key) -> { System.out.println( "Slow calculation of " + key);return fibonacci(i - 2) + fibonacci(i - 1); }); } The above program will print f(0) = 0 f(1) = 1 Slow calculation of 2 f(2) = 1 Slow calculation of 3 f(3) = 2 Slow calculation of 4 f(4) = 3 Slow calculation of 5 f(5) = 5 Slow calculation of 6 f(6) = 8 Slow calculation of 7 f(7) = 13 Slow calculation of 8 f(8) = 21 Slow calculation of 9 f(9) = 34 How would we have done it in Java 7? Good question. With lots of code. We’d probably write something like this using double-checked locking: static int fibonacciJava7(int i) { if (i == 0) return i;if (i == 1) return 1;Integer result = cache.get(i); if (result == null) { synchronized (cache) { result = cache.get(i);if (result == null) { System.out.println( "Slow calculation of " + i);result = fibonacci(i - 2) + fibonacci(i - 1); cache.put(i, result); } } }return result; } Convinced? Note, that your actual solution would probably make use of Guava Caches. Conclusion Lambdas are only one part of Java 8. An important part, but let’s not forget all the new features that were added to the libraries and that can be leveraged with lambdas now! This is really exciting and… We can greatly improve our code bases without resorting to new libraries. All of the above can be run with the JDK’s libraries only. Next week in this blog series, we’re going to look at how Java 8 will improve on the existing and new concurrency APIs, so stay tuned! More on Java 8 In the mean time, have a look at Eugen Paraschiv’s awesome Java 8 resources page   Reference: Java 8 Friday Goodies: Easy-as-Pie Local Caching from our JCG partner Lukas Eder at the JAVA, SQL, AND JOOQ blog. ...

Cost of Delay: Why You Should Care, Part 6

I’ve outlined five potential costs of delay in the previous five posts:The delay from not releasing on time, part 1 The delay from technical debt, part 4 The delay from ...

How To Succeed in Software Without a CS Degree

This week I was approached by two individuals seeking advice on finding employment in a programming capacity, yet both lacked the traditional standard requirement for entry-level positions – the BS in CS (‘BSCS’). I get asked about entering the industry often, and each scenario has a unique wrinkle. The most recent candidates were a fresh Ivy League liberal arts grad and a Physics Ph.D. The former had brief hobbyist programming experience and the latter gained light exposure during school. Both are immediately employable in other industries, but perhaps not in the field they now target. Of course, both may still be able to earn a BSCS (or MS) and take the traditional route. For our purposes here, let’s take that option off the table. For a Ph.D., the thought of additional classes might be hard to swallow, while costs might serve as a barrier for many others. Non-BSCS candidates are often at a distinct disadvantage when competing with BSCS grads for entry-level positions. It’s becoming more common for CS grads to enter the workforce with multiple internships and code samples to bolster their candidacy. It’s reasonable to assume that typical non-BSCS grads have nothing comparable, in addition to what may be considered a less attractive degree. One important point to remember is once you’re in you’re in, meaning that the most difficult job search for non-BSCS grads should be the first one. After gaining a bit of experience, your risk factor subsides (assuming you didn’t perform horribly in your first job). After three years no one cares about your major, and after five no one cares about your degree. What are the common approaches for a non-BSCS grad to break in? DIY and self-study (AKA GitHub, apps, certifications, blogs, and sites) – This method is based on the philosophy that you get a shot if you have a body of work. The wealth of freely available resources makes this method attractive to both the confident and the frugal. There can be a fine line between rigorous code immersion and post-graduation idling, so it’s helpful to set tangible goals, a schedule, and practice self-discipline. When given no direction on what to build, people usually struggle to find projects ideas. Look for suggestions like those on Martyr2′s Project list, and improvise. As for reading material, there are extensive lists of free programming books that may be helpful. All the material you need is out there and easy to find. Bootcamps – Any conversation today about breaking in for the non-BSCS will include bootcamps, and I have mentioned thoughts on them before. Bootcamps may be regarded as a compromise, where the investment of both time and money rests between DIY and degree programs. Some view bootcamps as an accelerated BSCS, or a hybrid internship and apprenticeship with classwork included. Most bootcamps appear as preparatory schools for startups based on the skill focus and instructors. Do your homework, and use caution when discussing the value of bootcamp experience versus degrees to avoid insulting employers. Internships, or cheap/free labor – Some organizations (think small businesses and non-profits) will let a non-BSCS perform development tasks as an intern or volunteer. This can be a clear ‘win-win’, as the organization gets productivity while you get somewhat valuable real-world experience. A combination of volunteer or internship and personal projects starts to level the playing field for a non-BSCS. Training in – There are companies that hire non-BSCS for entry-level programming jobs, and the first months include corporate training programs designed for non-CS grads. The positions may pay less than entry-level programming jobs, with curriculum intended to produce effective employees instead of versatile engineers. For example, instruction could focus on proprietary technologies and frameworks instead of popular industry offerings. What are some key items to consider? Get out of the basement! – Some DIY’ers bury their head in code and books with no human interaction. Make community learning events and outside communication a part of your diet. This will help you measure your knowledge in a live setting while also providing the opportunity to make some industry contacts. Don’t enter the job market too soon – For CS grads, the natural time to start the search is around graduation. No mystery there. For the non-BSCS, there is an instinctive rush to start applying to jobs early in order to take the temperature of the job market. Fight the urge. If you apply to a desirable company today and are subsequently deemed unready, don’t expect to be reconsidered in three months (when you are ready). Make sure you know enough to succeed in technical interviews, have your GitHub code clean and optimized, have any apps or sites tested and fully functional, and are prepared to make a strong impression. Leverage the skills you have to acquire the ones you want – Bringing useful abilities and experience that can pay immediate dividends (no matter how small) to an employer mitigates their hiring risk. If you are able to contribute to an organization beyond just code, providing both a learning opportunity and a decent wage is easier for firms to justify. Be realistic – Your three months of self-study or bootcamp are not likely to get you the dream job at Google. Be willing to start towards the bottom and pay your dues to move up. Beware certifications – When faced with a choice of proving abilities with either code or certifications, always pick code. Many industry pros attach a stigma to those who focus on getting certified instead of just doing. Make learning opportunity your #1 job search criteria for first jobs – The money will come. Trust me. If provided multiple job opportunities simultaneously, opting for a job due to an extra $2K or a commuting difference of five miles will be regretted. Find a place where you can learn and grow.   Reference: How To Succeed in Software Without a CS Degree from our JCG partner Dave Fecak at the Job Tips For Geeks blog. ...

Websockets with Spring 4

I am throwing the entire kitchen sink into a small web application that I am developing as part of this post – Spring Boot, Spring Integration, RabbitMQ and finally the topic of the post, the Websocket support in Spring MVC with Spring 4. Real-time quake listing application The final app will list the earthquake occurrences around the world and is updated in realtime(if a minute can be considered realtime enough), along these lines:          Storing the Quake Information The first part of the application is polling the data from USGS Earthquake hazards program every minute and storing it. I have chosen to store it directly into a RabbitMQ topic, which will be later used for the Websockets integration. Spring Integration is a great fit for the requirements of such a feature – using just configuration I can poll the USGS service providing a json feed of this information and write it to a RabbitMQ topic. This is how this flow looks:and a raw complete Spring integration flow for the same is the following, the only code missing here is the configuration for rabbitmq which is part of another configuration file: <import resource="rabbit-context.xml"/> <int:inbound-channel-adapter channel="quakeinfotrigger" expression="''"> <int:poller fixed-delay="60000"></int:poller> </int:inbound-channel-adapter><int:channel id="quakeinfo"/><int:channel id="quakeinfotrigger"></int:channel><int-http:outbound-gateway id="quakerHttpGateway" request-channel="quakeinfotrigger" url="http://earthquake.usgs.gov/earthquakes/feed/geojson/all/hour" http-method="GET" expected-response-type="java.lang.String" charset="UTF-8" reply-channel="quakeinfo"> </int-http:outbound-gateway><int-amqp:outbound-channel-adapter amqp-template="amqpTemplate" channel="quakeinfo" /> So, now that I have a flow which collects the Earthquake information and stores it into a RabbitMQ topic called “amq.topic” and internally plugs in a routing key of “quakes.all” to each of the quake information message, the next step is to figure out how to show this information dynamically on the browser application. Presenting the Quake information Spring Framework 4.0+ makes it easy to develop the web part of the application with the Websocket based messaging support now built into the framework. Spring 4.0 uses the STOMP as higher level protocol over raw websockets – I have included references which provide much more clarity on the details of the Websocket support. In essence, Spring will act as a intermediary for the browser to subscribe to the RabbitMQ quakes topic and display realtime information as new quake information flows in, this diagram from the references sums this up well:Spring 4 Websockets support with an external broker requires the broker to support STOMP protocol, which is easy to enable with RabbitMQ. With the STOMP support in RabbitMQ in place, the Spring MVC configuration looks like this: @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {@Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableStompBrokerRelay("/topic/"); config.setApplicationDestinationPrefixes("/app"); }@Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/quakesep").withSockJS(); } }“/topic” is being registered as a endpoint where Spring acts as a gateway to the RabbitMQ STOMP support “/app” is the application prefix where Spring MVC will listen for browser requests encoded within the STOMP message frame, in this specific instance I am not getting any requests from the UI and so this endpoint is not really used “/quakesep” is the websocket endpointThis is all that is required on the server side! Now for the client to subscribe to the message in the RabbitMQ topic, I have implemented it along the lines of the sample in one of the reference articles. The sample uses sockjs client, a javascript library for websocket emulation in browsers. This is how the javascript code to connect to the websocket endpoint “/quakesep” and subscribing to the “/topic/quakes.all” endpoint looks like. This internally registers a temporary queue with RabbitMQ for this websocket session and maps a AMQP routing key of “quakes.all” to this temporary queue, in essence sending all the quake messages to the temporary queue for the session. function connect() { var socket = new SockJS('/quakesep'); stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { console.log('Connected: ' + frame); stompClient.subscribe('/topic/quakes.all', function(message){ showQuakeInfo(message.body); }); }); } the showQuakeInfo function above simply displays fresh quake information when available from RabbitMQ.The entire sample was put together with Spring Boot, this has ensured that the dependencies declared in the pom file is kept to a bare minimum, the amount of configuration to start up the application is surprisingly small – essentially the WebSocketConfig code that I displayed above!I have the code available here in githubResourcesWebsocket architecture in Spring Framework Webinar on building Websocket based applications using Spring Framework  Reference: Websockets with Spring 4 from our JCG partner Biju Kunjummen at the all and sundry blog. ...
Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

15,153 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books