Saturday, March 27, 2010

ActiveMQ-CPP 3.1.2 Released

ActiveMQ-CPP v3.1.2 was just released. This version fixes some more issues found in the 3.1.x family improving overall stability. You can download the source bundle from here. This is a patch release so there were no API changes to worry about.

Wednesday, March 17, 2010

QueueBrowser now supported in NMS.ActiveMQ

After finishing up the QueueBrowser support in ActiveMQ-CPP I went back and reworked a patch that had been submitted to NMS to fully support the QueueBrowser in NMS.ActiveMQ. Wasn't to hard to do since the use was nice enough to submit unit tests along with the patch (love it when they do that) so I just had to tweak some things for all the recent changes that went in to get NMS 1.2.0.

Using the NMS version of the QueueBrowser is pretty simple, you can get the code from NMS.ActiveMQ's trunk. Here's a small snippet of code that shows how to use the QueueBrowser



IQueueBrowser browser = session.CreateBrowser((IQueue)destination);
IEnumerator enumeration = browser.GetEnumerator();

while(enumeration.MoveNext())
{
IMessage message = (IMessage) enumeration.Current();

// ...Do something with the message
}



Since the QueueBrowser returns a .NET IEnumerator instance it also supplies a Reset method that essentially just recreates the Browser session and restarts the Browse from the beginning.

Let us know if you find any bugs!

Tuesday, March 16, 2010

Just finished implementing QueueBrowser support in ActiveMQ-CPP

I just finished implementing the CMS QueueBrowser for ActiveMQ-CPP, it required me to make some changes to the QueueBrowser interface that was there but I think it was worth it. The JMS QueueBrowser uses an Enumeration returned from the JMS QueueBrowser as the way to browse Messages in JMS, so to keep things similar I created the CMS MessageEnumeration interface.

To use the QueueBrowser from CMS you just create a new QueueBrowser instance using your Session object and then get a MessageEnumeration when you want to browse the contents of the Queue. Here's a small snippet of code to demonstrate how its done.


std::auto_ptr browser = session->createQueueBrowser( queue );

// Enumerations are owned by the browser so don't delete or put in an auto_ptr
MessageEnumeration* enumeration = browser->getEnumeration();

while( enumeration->hasMoreMessages() ) {
cms::Message* message = enumeration->nextMessage();

// ... Do something with the Message

delete message;
}

browser->close();



The QueueBrowser is implemented in the ActiveMQ-CPP trunk.

Thursday, March 11, 2010

ActiveMQ-CPP now supports Message body compression

If you download the latest source from SVN you will find that you can now set the useCompression option on the Connection URI and your Message bodies will be compressed using a Java compatible ZLib deflater. This allows you to reduce larger payloads for faster transmission on the wire and should be fully compatible with the AMQ Java client and with the NMS.ActiveMQ client if you use the DotNetZip library in a compression policy, more about that later.