the corner office : tech blog

a tech blog, by Colin Pretorius

Java AMQP fun

I'm playing Eve Online again. There's a site called eve-metrics.com which has become a monster data hub. They spray their incoming data feeds via AMQP. Cool, thinks I, this'll be fun to play with and will make a change from JMS and the homegrown messaging systems I do battle with for a living.

There seem to be two main AMQP contenders in java. First up - RabbitMQ. Nifty, lots of people I know have said nice things about Rabbit. I copy and paste the maven snippet (no need to fire off IDE searches), I hack an example, I'm up and running after a few errors. Every time something bombs out I get a long cryptic error message from Rabbit. That's OK, it's got enough detail to make sense to me and be google-friendly. I'm up and running within minutes. The client's still bombing out with various network/frame size issues after a few messages, though. Perhaps it's a version thing? Maybe it's an issue with the AMQP broker? I'm a total n00b at this, so maybe I should try another implementation to see.

The alternative for Java is Apache QPID. Oh dear. It's an Apache project, but no public maven repository. Some outdated version in a repo, but not the latest. Gee, it's been a while since I had to manually hook jar files into an Eclipse project, but OK - I download the .tgz. and get it all linked up. This includes hooking in an slf4j binding, which needs manual linking because I'm no longer in maven country. This isn't fun.

Examples and tutorials? Lots of and lots of links on the site, but the Java stuff I want is just a link to example code in the svn repo. Which means I have to fire up an svn client and check out the code. Lots of code.

I dig around a bit. I try a topic listener. Self-contained, can't be too bad, can it? Sadly, not. I *think* I've got the connection details right, but every time I call con.connect() with what I think are a reasonable set of parameters, I get a ConnectionException. With absolutely no error message. Looking at the stack trace, it's an IllegalStateException in InputHandler.next(). Whatever that is.

Not cool. I could crack open the class and see what's actually happening to cause the IllegalStateException, except that I don't have the freakin' source code because this isn't a maven project and I'd have to go downloading sources and manually link them. No way, just no way.

At which point I decide that between an error with no error message and a lot of effort before I can try to make progress, I'm giving up on QPID.

It's not fair to knock open-source projects, it's not like I'm paying for any of this, and these people are sharing their code - good on them. But if you're going to share software, it's a shame if it's not doing simple things to make users' lives easier. In this day and age, and especially when there are other competitors, that means things like maven repos, like a wiki page saying 'do it like so', and spitting out sensible error messages. Especially if you enjoy the eminence of being an official Apache project.

If the code's bombing out on line 2, with no way to figure out how to resolve the problem, then you're losing potential contributors and users.

Update: and after a bit more playing and digging through the Javadocs, and convincing myself that everything worked fine by using a Python implementation, I worked through the problems I was having with the RabbitMQ test client, and now it's working like a charm. Happy, me.

{2010.04.16 16:05}

« C4251

» The Dark Magic of Structured Finance