Ruote-Stomp Ping Pong
Just returning from some time with the DevOpsDays crew and a bit of an extending “vacation” at the Taos Holy Cross Hospital (after my son’s attempt to fly a mountain bike down the Angel Fire ski resort :)). I’ve been meaning to get this tidbit blogged for a bit, but it just hasn’t happened - seemingly more typical these days. Ah well.
Quickly, here are the players:
This story began with the AMQP-based Ping Pong exercise as I was looking hard at Ruote for a project needing remote, distributed work units, similar to what is possible to Resque that could be attached to managed workflows.
Ruote itself is deserving of an entire blog post. It is an amazing framework, that captures the need for a simple, lightweight engine that could - do more than basic state machine stuffs - accommodating standard workflow patterns.
Although I think AMQP is definitely up to the task of brokering the work units, I need something that can be run from within a JVM, and is a bit easier to test in isolation. Since the only content that is passed between Ruote’s “engine” and “participants” is textual, and JSON at that I figured the Stomp protocol was a logical choice. Stomp is supported in many messaging brokers (ActiveMQ, RabbitMQ, stompserver). So, I set off to port the AMQP ping pong setup to Stomp.
I shamelessly started with the work Kenneth Kalmer did in the ruote-amqp gem, simply swapping the appropriate AMQP calls for Stomp calls. And, thus ruote-stomp was born. It tests pretty easily with the embedded ruby-based stompserver.
I then needed to get the ping and pong participants to use stomp. The AMQP-based ping pong version uses daemon-kit to build participants that consume work off of queues. So, I then forked Kenneth’s work, and added the stomp capability.
The end result, my Ruote-Stomp Ping Pong experiment, can be found at https://github.com/kitplummer/ruote-stomp-ping-pong. To run it is pretty straightforward:
Clone the ruote-stomp-ping-pong project.
Open 3 terminal windows and cd into each project subdirectory (ping/, pong/, ping-pong-engine/).
➜ ping bundle
➜ ping bin/ping
➜ pong bundle
➜ pong bin/pong
➜ ping-pong-engine bundle
➜ ping-pong-engine stompserver &
➜ ping-pong-engine ruby lib/main.rb
Please comment: blog comments powered by Disqus