Vertx Work Queue Playing

Got board late one night, so thought I’d muck around with Vertx mod-work-queue.  The runmod feature of Vertx is nice, and avoids the madness of having to find modules on the web:

vertx runmod io.vertx~mod-work-queue~2.0.0-final

Best is to pass some conf params 🙂 and also run in cluster mode:

“address”: “trading.test”

vertx runmod io.vertx~mod-work-queue~2.0.0-final -conf mod-work-queue.conf -cluster matt

Which gives me a cluster running work-queue on a default address:

Starting clustering…
No cluster-host specified so using address

So now to my processor code.  Due to the lateness of the hour, I got stuck on how the acceptedReplyAddress should work:

var vertx = require('vertx');
var eventBus = require('vertx/event_bus');
var console = require('vertx/console');
var container = require('vertx/container');

console.log('Trading Verticle has been started');

vertx.eventBus.send("trading.test.register", {
"processor": "processor1"
}, function(reply) {
if (reply && reply.status === "ok") {
console.log('Processor1 Registered for trading');

vertx.eventBus.registerHandler("processor1", function(message, replier) {
console.log('Process trading work ' + JSON.stringify(message));

var msg = message.message;
console.log('Message was ' + msg);

// Send the reply

var myHandler = function(message) {
console.log('Received ack');

vertx.eventBus.registerHandler('test.acceptedReplyAddress', myHandler);

eventBus.send('trading.test', {
accepted_reply: "test.acceptedReplyAddress",
message: 'FIX <35>'});

~ by mdavey on January 4, 2014.

2 Responses to “Vertx Work Queue Playing”

  1. Hey Matt, I’m curious – did you actually get those accepted_reply ack’s? I can’t seem to get them for the life of me…

  2. To answer my own comment – it looks like in the current build, the format for the “accepted-reply” address is now using a hyphen instead of an underscore:

    So it’s {“trade”: “FOO”, “accepted-reply”: “that-address-over-there”}

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: