This week I attended the CodeMash conference in Sandusky, OH. The conference was another excellent oppertunity to really reach out to other technologies and see what I could learn from them. And I had just that opportunity when I say a tweet from my buddy Karthik that he was going to pair with another friend of mine on the new hotness node.js. I quickly bounced out of my seat and ran upstairs to join in on the fun. As with learning any new language its helpful to have a problem to solve. As would happen I have recently written a naive port of my OSS project MassTransit for the Ruby language for my talk. Knowing that there wasn’t a whole lot to it I thought this would make a great problem to tackle.
For the purposes of this small port I am focusing on the core set of functionality. Subscribe to messages, execute callbacks when messages arrive, and publishing messages. This means that I also have to be able to serialize the objects as well.
The transport we used was RabbitMQ, it’s one of the newer queuing systems out there that is built on erlang. You can read all kinds of good stuff about it just using the goog’s so I encourage you to do that.
First we had to go get ‘npm,’ the node package manager, (sweet, npm is on homebrew) once we had that we pulled down the ‘amqp’ package which allows us to talk to rabbitmq. Sweet.
was as much code as the class definition. Which brings up, it was weird to serialize js objects to string based forms in JSON. Unsuprisingly, it was stupid easy to do this, so our serializer.js was also very easy to write.
Next and finally is the serviceBus.js module. this module aggregates the callbacks by message type, so I was able to learn about dictionaries and lists, and how to construct larger classes.