Friday, July 25, 2014

A tryst with Message Queues Pt. 2

So far...
I'm sending data to a RabbitMQ broker as messages. These messages get queued up in a user configurable queue. Supposedly a consumer is going to process these. But the consumer is out of my view.
Doesn't matter.
Now there came a feature of receiving notifications from the consumer or some other system. So after some discussion, the powers to be decided that we are going to have a notification queue which the client has to read. And from it we get the notifications to be read. Now the shady part of business was I had no idea what the hell is going on the inside of libStomp. So I ask politely that I don't have any read code. And I get handed over a single stomp_read code snippet. (In whiny voice) They said it works!!! But it doesn't!!! I tried so hard!!! Damn!!!
So I looked into the protocol to understand why the hell I am no getting anything. After reading the protocol, I came to know that the implementation is fucked up in ways more than a few. First STOMP is a message send and receive protocol. Which means when we prepare a CONNECT frame, we are supposed to get a reply as CONNECTED along with server connection settings.
Now the original code sample which I was using for sending the data had all stomp_read calls commented out. And after I tried to run that sample with the read calls uncommented. And there I also ran into the same problem. That meant there could be either a server problem or a client problem.
I didn't have any other verified STOMP server, So I decided to check if RabbitMQ is the culprit. Thankfully at the stomp_ plugin page on RabbitMQ website, they have clearly given this procedure. After trying out the telnet routine I ran into an interesting problem.
At first CONNECT, I got invalid error command. Next any CONNECT worked out. After scratching my head for a while I remembered that putty does active negotiation for telnet connection. So I went into putty settings and tried out passive negotiation. That worked. And it also meant that RabbitMQ server is operating fine.
So the culprit must be libStomp. But even after extended search on the net I didn't get any occurrence of my problem.
Later after going through all the protocol stuff I tried out SUBSCRIBE command and even though RabbitMQ logs suggested that the operation has succeed, there was no response read.
That's the current state of things. I have given up on reading up stuff and instead I am going to integrate the working bits into our product. Later I'll see if the reading is working. Else I am thinking of writing my own STOMP message since its all text anyway.
Let's see!!!

No comments:

Post a Comment