Friday, July 29, 2011

OSCON 2011 - Mission Accomplished


OSCON 2011 - Mission Accomplished and a week of amazing learning and networking is finally coming to an end. I had flown in not only for OSCON Java but also for the Community Leadership Summit, that took place last Saturday and Sunday (but Sunday, I attended the JVM languages day instead, which was wonderful as well).

I was super-impressed with the variety of people from all over the planet, not only the US but also Europe and the Americas. E.g. if you saw somebody wrapped in a flag…that was Bruno Souza, the man that has put Brazil on the map for Java developers. Furthermore, all the cool open-source companies that you could ever think of were present as well. Just an awesome level of energy there.

Also, I was able to connect with a ton of VMware/SpringSource folks at the event that I hadn’t met personally before, yet. Just to give you an idea of how awesome the open-source community is: On Tuesday we went out for some great food at McMenamins Kennedy School. It is housed in an old school with everything left intact/restored (incl. the showers in the rest rooms). That place has 5 bars, restaurant and excellent outdoor seating.

Anyway, our group included Dan Allen from JBoss (member of the Seam, Weld and Arquillian projects), Peter Neubauer from Neo4J (Founder, good chance for me to speak some German ;-), William  Rowe from SpringSource (Apache Foundation Vice President, HTTP Server), David Blevins from IBM (Co-founder of Geronimo and OpenEJB), Mark Johnson from SpringSource  (President of NEJUG),  Bruce Snyder from SpringSource (ActiveMQ comitter), Josh Long from SpringSource (Developer advocate and author), Steve Mayzak from SpringSource (Author). Seriously, to me, this was like being backstage! Thanks for having the chance to meet you all!

Back to OSCON here are the sessions I was able to attend:

Monday

  • Theory of Caching (Greg Luck)
  • Java Puzzlers – Scraping the Bottom of the Barrel (Josh Bloch, Bob Lee)
  • The Ghost in the VM: A Reference to References (Bob Lee)

Tuesday

  • Everything You Wanted to Know about Open Source that Nobody Told You (Jeff Genender)
  • Managing Thousands of Cloud Instances with Java (Patrick Lightbody)
  • ActiveMQ in Action – Common Problems and Solutions (Bruce Snyder)
  • The Evolution of Java: Past, Present, and Future (Josh Bloch)
  • From Ruby on Rails to Java: The Gory Details (Steve Jenson) 
  • A Giant Hop Forward with Spring Roo (Steve Mayzak and Josh Long

Labels: , ,

Thursday, July 21, 2011

Priority Channels in Spring Integration

As somebody was asking about a Priority Channel example for Spring Integration in the forums today, I went ahead and created a simple example. You can grab the source code over at GitHub:

https://github.com/ghillert/spring-integration-examples/tree/master/priority-channel-example

For some additional information check out the related forum entry:

http://forum.springsource.org/showthread.php?112368-PriorityQueue-example-needed

Labels: , ,

Monday, July 4, 2011

HTML5 WebSockets for JVM Developers

Anything related around HTML5 seems to be a hot button topic these days and lucky for me that I got an opportunity to take a deep dive into WebSockets. Thus, I will use this blog to post my findings over the next few days and I will present some simple code examples as well.

Anyway, WebSockets allow Servers to basically "push" data back to subscribed Browser clients in an effective manner instead of using workarounds such as long-polling. The WebSockets API is being standardized by the W3C (http://dev.w3.org/html5/websockets/) and the actual protocol is being defined by the Hypertext-Bidirectional (HyBi) working group (Part of IETF) - http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-09.

For further reading and to learn more about WebSockets in general, please also check out the following resources:
It turns out, though, that the only browsers, that support WebSockets out of the box right now, are Safari and Chrome. Wait - Firefox is not supported? Well, Firefox does support WebSockets but it is disabled by default due to security issues with the implemented draft version of the WebSocket protocol (Firefox 4+5). You can find more information about this here:
Nonetheless, if you're interested, you can re-activate WebSockets in Firefox 4 and 5 quite easily. Take a look at the following link for more information on how to do this:
Firefox 6 is supposed to bring back websockets support, albeit using a newer draft of the websocket protocol (hybi-07), which is not backwards compatible.

What about Web Servers?

Okay, so WebSockets look cool, yet with limited browser support. Furthermore, different webservers have varying stages of support for asynchronous messaging, with Jetty and Glassfish being the best options currently a provide native websocket support. It looks like Resin also has direct websocket support. See also:
Tomcat 7 currently does not support WebSockets, yet. Check out the following issue tracker entry to learn more about the current state of affairs in Tomcat 7:
What's next?

So, essentially what we want is some kind of framework that supports "graceful degradation": when available a suitable framework shall use websockets, but if not available, the framework should fall back to more traditional push work-arounds such as long-polling.

On the server-side, I am running Java, and therefore, I need a respective implementation on that platform. Choices, though, seem to be rather limited and I came up with the following list of options:
Just for reference, there seems to be quite some activity going on outside of Java:
My choice for now

Socket.IO looks like it has quite some traction but the default implementation is for Node.JS. There are Java implementations available but they did not seem to have much traction. jWebSocket actually looks promising but its licensing (LGPL) is too restrictive to me (My choice needs to be Apache license compatible ;-).

Out of the list above, I chose Atmosphere (http://atmosphere.java.net/). Atmosphere has pretty much all the features you would like to have incl. detecting server-side capabilities and using the best possible approach transparently. Atmosphere comes with a jQuery plugin that abstracts away the implementation details (same Api for using long-polling vs. websockets)

While Atmosphere comes with quite a few examples, they are interestingly mostly for JAX-RS and there are no examples for Spring MVC. Also, the documentations is rather limited but luckily you get very swift and helpful responses from Atmosphere mailing list.

In my next posting, I will provide a little example integrating Spring MVC and Atmosphere. So stay tuned.

Nevertheless, if you have other WebSocket recommendations and/or thoughts, please leave comments!

PS:

A funny thing, I just realized that Burr Sutter, a friend of mine and fellow AJUG board member wrote down his WebSockets research experiences as well. It is a small world. Go check it out at:

Labels: , ,