Enterprise Integration Zone is brought to you in partnership with:

Mitch Pronschinske is a Senior Content Analyst at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often eats peanut butter and bananas, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone Zone Leader and has posted 2576 posts at DZone. You can read more from them at their website. View Full User Profile

Clojure's core.async Library Can Make Using Async APIs in Java Suck Less

07.23.2013
| 1847 views |
  • submit to reddit

Callback hell isn't just a problem for JavaScript developers.  Java devs have to deal with it too when they're using asynchronous APIs.  Malcom Sparks has a tool that can help though... the Clojure core.async library.

To provide some background, I’m working on a client project which is sourcing MQTT (MQ Telemetry Transport) events from sensors and processing them with Storm. If you haven’t heard of MQTT, it’s the protocol driving the ‘Internet of Things’. For my test harness I’m publishing test messages using a Java-based MQTT API client-library, Eclipse Paho.

-- Malcom Sparks, MQTT in Clojure with the core.async library


Follow the link  to his blog for all the code snippets.