A tryst with message queues Pt. 4

So far... I have installed RabbitMQ server on my development machine and using it to test my development code. I have STOMP_SEND working fine. Using the management web console for RabbitMQ I can see the messages being queued. Now I have to read the sent messages. And here I stumbled into a situation where libstomp's stomp_read function was failing.
So now going ahead, I integrated the message sending code into the product. The requirement was simple. We had to send a fixed message to a queue with time stamp every two mins. So I put together a thread and put the message sending logic into it.
After testing it, I started work on the read part. The requirement was simple. The product has to read some messages from a queue and display them to user.
Thankfully one of the system guys fixed libstomp ( saving me some efforts :D ), and made the stomp_read working again.
So after putting together a test application to read from the queue, I ended up with a no of problems. First of them was garbage data read into the frame. Second was even more interesting. Even if I had multiple messages queued in, I would receive only one message and rest will be lost. Next there was also a problem with the ack mode.
So I shifted gears into study mode and started going through the protocol specification. There I learned about a few things and so I made following changes. Set body.length field to message length and using it restricted the amount of string read. That fixed the garbage message problem. Next I set prefetch-count to 1 and tried the test application. There was still the problem of unacknowledged messages. To fix this I got hold of message-id header and using it, sent ack frame. That fixed the unacknowledged messages problem.

So I guess that fixed everything. Later I put all this onto test platform for about 12 hrs and thankfully things worked out well and it all didn't tank.
So I guess we are finally good with STOMP.

Comments

Popular posts from this blog

Morning Quotes

QCalendarWidget CSS Stylesheeting