Friday, December 10, 2010

ActiveMQ-CPP v3.2.4 Released

ActiveMQ-CPP v3.2.4 is out now. 

 This release addresses some issues with the CMSTemplate classes and fixes a Stomp bug that was preventing the client from making connections via stomp. 

There were also some changes in the Autotools scripts that hopefully make the pkg-config and libtool versions work together better.

The source bundle is available on the release page, download it from here:

Tuesday, November 9, 2010

NMS.Stomp now has Stomp v1.1 support

If you checkout the trunk code of NMS.Stomp you can now connect up to a Stomp v1.1 broker and it will take advantage of the new features in the Stomp v1.1 spec.  I started working on this on Friday and think I've got everything working now.  So what do you get, well for now the main thing is that Stomp v1.1 supports heart beats between client and broker so the NMS.Stomp client is much more resilient when it comes to detecting that its connection to the broker has dropped.  The Failover Transport that I added to NMS.Stomp in v1.4 should get informed by the inactivity monitor now much quicker that it needs to reconnect.

You can try it out using the Apollo broker which you can download from here.

Wednesday, October 27, 2010

FuseSource now officially launched.

Its now official, FuseSource is now operationally independent from Progress Software, Rob has explained the background along with Larry's interview and Dana's podcast much better than I could have.

This is exciting news and the future of FuseSource looks to be bright.  The team is growing and still includes the talent that brought about Apache ActiveMQ, Apache Camel and Apache ServiceMix.  The Roadmap for 2011 looks to be a good one with continued work on the Apache projects we all know and love as well as some great new FuseSource projects that are currently in the works.  Should be fun times ahead...

Tuesday, October 26, 2010

ActiveMQ C API under development

Recently I started working on a C API for ActiveMQ.  The idea is to wrap the ActiveMQ-CPP library in a C accessible API in order to leverage all the hard work that has gone into making the C++ client.  I've made some good progress so far, I've wrapped all the CMS API's for ConnectionFactory, Connection, Session, Producer and Consumer.  I'm part way through mapping the CMS Message APIs into C APIs.

We still don't have any unit tests written for it but there's some sample code that compiles, and runs (at least it did). 

It would be great if some C developers out there wanted to chip in and help out on this as my C skills are pretty rusty.  There's still a lot to be done in the wrappers like better managing error conditions and reporting the errors in a meaningful way. 

You can download the source from the Apache SVN here.

Monday, October 4, 2010

Enhanced JMS Scheduler in ActiveMQ

Previously we added the ability to schedule delivery of Messages on the ActiveMQ broker.  To schedule a message all you need to do is create the Message and then set some properties in the Message headers, simple right, and it allows for pretty much any client to access this functionality whether it talks Openwire or Stomp.  To manage those scheduled message however you were limited to using the JMX console or the Web console, and while it nice that you can manage them the current setup does prevent Stomp users from playing. 

This weekend I coded up a patch that allows you to manage your scheduled messages much the same way to create them in the first place, by sending some Messages.  I've added support for requesting that the broker send all the scheduled messages to a destination of you choosing as well as allowing you to then request that certain messages be deleted from the schedule, or all of them for that matter.  Lets take a look at how it works...

First thing you probably want to do is to see what messages are scheduled, so to accomplish that you need to create a Producer that publishes on the Destination named: "ActiveMQ.Scheduler.Management".  Once that's done you create a new Message and set some properties and add a Reply To destination so the scheduler knows where to send your Messages.  Then all you need to do is process the messages with a Consumer that is subscribed to that Reply To destination.

        Connection connection = createConnection();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

        // Create the Browse Destination and the Reply To location
        Destination requestBrowse = session.createTopic(ScheduledMessage.AMQ_SCHEDULER_MANAGEMENT_DESTINATION);
        Destination browseDest = session.createTemporaryQueue();

        // Create the "Browser"
        MessageConsumer browser = session.createConsumer(browseDest);


        // Send the browse request
        MessageProducer producer = session.createProducer(requestBrowse);
        Message request = session.createMessage();

        Message scheduled = browser.receive(5000);
        while (scheduled != null) {
            // Do something clever...

With the above code your consumer will be able to check all the Messages that are scheduled.  Now if you happen to have a huge number of Messages scheduled then you probably don't want them all sent to your client, so to narrow down the results you can add two additional properties to your request Message to define the time window that you are concerned with, here's the browse request code again with the properties added to see what is scheduled for the next hour.

        // Send the browse request
        long start = System.currentTimeMillis();
        long end = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1);

        MessageProducer producer = session.createProducer(requestBrowse);
        Message request = session.createMessage();
        request.setStringProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION_START_TIME, Long.toString(start));
        request.setStringProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION_END_TIME, Long.toString(end));

Now that you have seen how to browse the messages that are scheduled for delivery lets take a look at how to manage the scheduled Messages that you've browsed.  Each scheduled Message that is sent to your consumer contains in it a Job Id that can be used to remove that scheduled Message from the Scheduler using the same management destination that you used to request the browse from, here's an example of that.  

        Message remove = session.createMessage();

Here we create a new Message and assign it the remove action property and then set the Id of the scheduled using the Id from a Message that was sent to us on the browse destination we created earlier.

If you want to remove some scheduled Messages but don't want to browse them just to find the one's you are interested in you can do so using the remove option show above but instead of specifying an Id you can give it a time window in which to operate, here's an example show a remove operation requested for all scheduled Messages in the next hour.

        long start = System.currentTimeMillis();
        long end = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1);

        Destination management = session.createTopic(ScheduledMessage.AMQ_SCHEDULER_MANAGEMENT_DESTINATION);

        MessageProducer producer = session.createProducer(management);
        Message request = session.createMessage();
        request.setStringProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION_START_TIME, Long.toString(start));
        request.setStringProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION_END_TIME, Long.toString(end));

You can also remove all jobs from the scheduler with a single message, this is shown in the next example.  

        Destination management = session.createTopic(ScheduledMessage.AMQ_SCHEDULER_MANAGEMENT_DESTINATION);

         MessageProducer producer = session.createProducer(management);
        Message request = session.createMessage();
        request.setStringProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION, ScheduledMessage.AMQ_SCHEDULER_ACTION_REMOVEALL);

That's it for now.

Friday, September 24, 2010

Apache.NMS.Stomp v1.4.0 released.

The Apache.NMS.Stomp 1.4.0 Release bundle is now available. This release is based on the Apache.NMS API v1.4.0 and runs on .NET frameworks 2.0+, .NETCF 2.0+ and Mono 2.0+.

Changes in this version include

* Added a FailoverTransport to the Stomp Client.
* Improved URI handling in all NMS clients.
* Improved handling of Request Timeout settings.
* Added a new SetBytes method to IMapMessage.
* Added a new MessageTransformer API.
* Many bug fixes.

There are release binaries and debug binaries (with PDBs) provided. The binary ZIP files include pre-built assemblies for all of the platforms that are supported.

You can download the source and binaries from here.

Friday, September 17, 2010

Apache.NMS.ActiveMQ v1.4.0 officially released.

Apache.NMS.ActiveMQ v1.4.0 has just been released.

This release fixes several bugs found since the 1.3.0 release and also adds some great new features.

  • Improved URI handling in all NMS clients.
  • Improved handling of Request Timeout settings.  When a request times out now you will see a RequestTimedOutException thrown.
  • Added a new SetBytes method to IMapMessage.
  • Added a new MessageTransformer API, you can now intercept a Message as its sent or received and add / update / or replace that message.
  • NMS.ActiveMQ will now handle transforming foreign NMS Messages into its own internal format when they are sent so you can easy route Messages from one NMS provider to another.
  • Many new Unit Tests added to the Test Suite.
You can download the binaries and source bundles here.

Monday, September 13, 2010

ActiveMQ-CPP v3.2.3 Released

A new release of ActiveMQ-CPP is out today, v3.2.3.

This versions fixes a couple of issues with the 3.2.2 release.
  • Fix a threading issue when multiple connections were created from two or more threads at the same time.
  •  Fix a segmentation fault when a MapMessage is received with a bytes array element that is empty.
  •  Fix the pkg-config script to reflect the actual libtool library version and not the official release version.
You can download the source bundles from here.

Friday, August 27, 2010

Don't miss out on Apache Camel Webinars at FuseSource

Coming in September there will be two new interactive webinars at FuseSource covering topics on Apache Camel.

  • September 8th - Claus Ibsen will give an introduction to Apache Camel including: core concepts, EIPs, components, and the community.
  • September 16th - Jonathan Anstey will go over deployment options for Camel including: embedded Java, Spring, ActiveMQ, ServiceMix (OSGi) and web app. This will include a live demonstration of deploying a Camel application in ServiceMix.
These interactive sessions provide a great resource for learning more about the projects and give you a chance to interact with the developers of the project.

You can register for the events now.

Don't forget you can also see archived webinars by going to the FuseSource site right now.

Sunday, August 15, 2010

Check out the Enterprise ActiveMQ Webinar

Besides the sure to be fun FUSE meetup next week in Boston there's also going to be a great Webinar next week on August 19th covering using ActiveMQ in an Enterprise environment given by Rob Davies.  To attend you just need to go to fusesource and signup

Rob will be covering several key topics such as Failover, high availability and scaling, along with covering some of the new features in the upcoming ActiveMQ 5.4.0 release.  Don't miss out!

End of Summer Reading

Just in time for that late August vacation there's two really cool books coming out from Manning: ActiveMQ in Action and Camel in Action

To get a taste of what's offered in these books fusesource has exclusive excerpts available for free (no registration required):
- Chapter 9: Learn about using transactions with Camel
- Chapter 5: Learn how messages are stored in AMQ on KahaDB

Even better is that there's a great discount for both books, and all you have to do isstop by the fusesource site to find the 40% discount code you can use when ordering from the Manning web store.
Having just finished the ActiveMQ in Action book I can say its packed with great information that you can use when getting started with ActiveMQ and even for those that have been using it for awhile there's still plenty to take away from this book.
Camel in Action is already on the top 15 bestsellers list at Manning which should tell you something about the interest in Camel.  I plan on picking up a copy soon myself.

Don't miss out on the FUSE meetup next week.

Next week there's a couple of really cool events going for those who want to learn more about ActiveMQ ,Camel, ServiceMix and CXF, plus you can meet many of the people that are active on those projects. 

First up there's an event poolside at the hip Indigo Lounge on Tuesday evening, August 17th.  This should be a lot of fun (wish I was going), make sure you sign up so we know you're planning to attend. 

From the invite:

Get the latest news on Apache ServiceMix, ActiveMQ, CXF and Camel. Discuss how others are using open source integration software and get advice from top integration and messaging experts. Learn more about FUSE Forge and the Apache Software Foundation and how you can get more involved using and contributing to open source integration software.

Meet the FUSE Rock Stars in person.

  • Rob Davies: Co-founder of Apache ActiveMQ, ServiceMix and Camel.  Co-author of ActiveMQ in Action.
  • Stan Lewis: Committer on Apache Camel and open source expert on Apache projects
  • James Strachan: Co-founder of Apache ServiceMix, ActiveMQ and Camel 
  • Claus Ibsen: Top contributor to Apache Camel, co-author of Camel in Action 
  • Guillaume Nodet: Co-founder and top contributor to Apache ServiceMix, committer on Apache ActiveMQ, CXF, Camel , Geronimo, XBean, GShell, and ODE. 
  • Hiram Chirino: Co-founder of Apache ActiveMQ and Camel, top contributor to Apache ActiveMQ            
  • Chris Custine: Committer on Apache ServiceMix, Directory Server, and Felix
  • Hadrian Zbarcea: PMC Chair of Apache Camel

Meet and network with peers at this free meet up.
Register now.
Date: August 17th, 2010
Time: 4:00 PM to 7:00 PM
Location: Hotel Indigo Hotel, 399 Grove Street, Newton, MA 02462

Friday, July 30, 2010

ActiveMQ-CPP v3.2.2 Released

A new bugfix release of ActiveMQ-CPP is out v3.2.2.  For this who have experienced segfaults from APR Atomics on startup this release should address all those issues.  There is also a fix for some bugs related to sending and receiving empty MapMessage objects.

You can download the source bundle from the ActiveMQ-CPP release page:

Friday, July 2, 2010

ActiveMQ-CPP v3.2.1 Released

A new patch release of ActiveMQ-CPP is out, v3.2.1, you can download it from here.

This release targets some problems with the initial 3.2.0 release on Windows, the Visual Studio project files didn't get included in the final archives, this version now correctly include the Visual Studio 2008 project files (Note that Visual Studio 2005 users will have to down convert the project files).  Also a compilation issue was addressed.

Some testing has been done using Visual Studio 2010 but 2008 is the current recommended compiler. If you convert the project files you will need to make one small change in the updated VS2010 project for activemq-cpp which is to change the "Target Name" for the project from the value given in the update to the following:

For all static lib builds in Debug mode it should be
Target Name = lib$(ProjectName)d

For all static lib builds in Release mode it should be
Target Name = lib$(ProjectName)

As always your feedback and bug reports are welcome, especially if you include good tests that reproduce the problem :)

Tuesday, June 29, 2010

Free stuff Rocks!

For those who are curious about how ActiveMQ actually works internally then you should check this out, FuseSource ( is offering a free excerpt from "ActiveMQ in Action" and "Camel in Action" books at

Find out more on how ActiveMQ stores messages and what's the role of
transactions in Camel and get your discount on these great new titles. 

Friday, June 18, 2010

ActiveMQ-CPP v3.2.0 Released

The next version of ActiveMQ-CPP is now out, v3.2.0.  This version includes support for SSL using the OpenSSL library, as well as a functional QueueBrowser and message body compression.

You can download the source bundle from here

The CMS site also has an updated FAQ page that details how to build and use the new SSL support, you can find that here.

Friday, May 28, 2010

Apache.NMS.Stomp v1.3.0 officially released.

The v1.3.0 of the Stomp .NET client is now out and includes support for SSL.  You can download the release binaries from here.

This release also has several bugfixes as well.

Friday, May 21, 2010

Apache.NMS.ActiveMQ v1.3.0 officially released.

The v1.3.0 of the ActiveMQ .NET client is now out and includes support for SSL and QueueBrowser.  You can download the release binaries from here.

Also in this release you can now configure the local address and port that the tcp and ssl connection will bind to using the connection URI, see this article for an example.  Also the FailoverTransport now supports the "timeout" parameter which indicates how long a send should block before failing if there's no current connection.

This release also has several bugfixes as well.

Thursday, April 1, 2010

Ussing SSL in NMS.ActiveMQ

With the recent addition of SSL support into NMS.ActiveMQ and NMS.Stomp I thought it'd be a good idea to write an article covering how to use the new functionality and explain some of the things to watch out for.  At the time of this writing the SSL support is only in the trunk code, but will make its way into the NMS 1.3.0 release some time soon, until the release you can go to the NMS Site to get the latest code and find build instructions.  

Once you have your NMS and NMS.ActiveMQ builds in hand you need to do a few more things before you can connect to a broker via SSL.

Broker SSL Configuration

The default broker configuration doesn't enable SSL so the first thing you need to do is add configuration of the SSL Transport to your Broker's configuration file, there's a pretty good how-to on the ActiveMQ website showing how to do that, so I won't reproduce it all here.

Of SSL Certificates and Trust

Now that you've configured your broker to support SSL connections its time to setup the client machine so that your newly built NMS and NMS.ActiveMQ assemblies can actually connect.  When the NMS client tries to connect over SSL its going to want to validate that it can trust the server on the other end of the connection, this implies that the Certificate the broker sends the client when it connects is one that we trust.  The trust relationship between the .NET client and the Broker comes from the broker sending a certificate that is either signed by a trusted Certificate Authtority or by virtue of us having added the Certificate itself to our list of trusted Certificates.

To add the Broker's Certificate to the list of trusted Certificates that .NET clients are aware of can be a painful and mysterious process.  I'm working from a Linux box running Mono so I can tell you how to I did it, how its done on a Windows machine might be a bit different.  

By following the instructions on the ActiveMQ sites "How do I use SSL" article you should have exported your Broker's SSL Certificate to a file named broker_cert (I named mine broker.cer instead).  You can use the 'certmgr.exe' command to add that certificate to you list of Trusted Certificates like so:
certmgr -add -c Trust broker.cer
This add the Certificate to a list of trusted Certificates that should allow your NMS client to connect without encountering validation errors.  I'll give you a hint on another way to make the connection to the Broker without adding the Certificate to you Trust store later on.

Connecting over SSL with NMS.ActiveMQ

Like any other connection using NMS the way we specify what server to connect to and how we want to do so is done via the connection URI.  This means if you already have a working NMS client you can easily start using the SSL functionality simply by referencing the new Assemblies and updating you connection URI.  So what does the new URI look like?  Pretty much the same as the old one except where you would have put tcp you now put ssl.  Sounds easy, lets take a look at a URI that I use to connect to my Broker:
That's it, same old URI, new protocol. If you added the Broker's certificate to the Trust store then your client should connect and run just like it always has.

Something Went Wrong!

Well you knew it was to good to be true, it couldn't be that easy.  You tried running your client and got a bunch of exceptions when it tried to connect, what to do.

A couple things can go wrong here, lets take a look:
  • The Broker Certificate wasn't in the Trust store.
  • The host name in the URI you used to connect doesn't match the common name of the Certificate your broker is using.
Earlier I showed you how to add the Broker's certificate to the Trust store, but maybe you didn't read that part, or maybe you couldn't figure out how to accomplish that for your particular version of Windows, well there's a workaround.  Since I didn't want to always have to put the dummy self signed Certificates that I test with in the Trust store I added an URI option in NMS.ActiveMQ to let me bypass this, its called 'transport.acceptInvalidBrokerCert' and your URI would look as follows if you decided to use it:
This options pretty much forces the NMS client to accept any old Certificate that your Broker sends, so best to only use this in test environments.

Now onto the other common problem, your Broker's Certificate could have something in its Common Name field that's not the same as the host name you put in your URI.  This could happen for a number of reasons especially when you are using self signed Certificates, fortunately we gave you a way around this one as well, if you need to override the name we use to look up the Server's Certificate from the host name use the 'transport.serverName' option:
ssl://localhost:61617?transport.serverName=\"My Test Cert\"
This will cause the NMS code to use "My Test Cert" as the name of lookup when authenticating the Server connection.  Normally the name in the Certificate would match the URL of the server but when testing you might just be using IP addresses so this is a convenient workaround.


That's about all there is to it, pretty easy right?  There's more to it if you want to do two way Client / Server authentication but I think I will save that for another posting.  Hopefully you found this somewhat helpful.  If you have questions or comments please let me know, I will update the posting if something is unclear or incorrect.

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();

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;


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.

Thursday, February 25, 2010

Added SSL support to NMS.ActiveMQ today

I spent the last couple days trying to decipher MS documentation on SSL support and finally figured out enough to get basic SSL support working in NMS.ActiveMQ. No bells and whistles yet in the SSL transport but it seems to work fine with AMQ so I'm happy. Would love it if some users would checkout trunk and give it a spin, let me know what you find and what you think needs fixed / added.

Saturday, February 20, 2010

ActiveMQ-CPP 3.1.1 Released

ActiveMQ-CPP 3.1.1 was just released. This is a patch release so there's no API changes or other major internal changes, just a few memory leak fixes that should help to improve overall stability. Grab your copy today from here:

Friday, February 12, 2010

Apache.NMS.ActiveMQ v1.2.0 officially released.

Finally, the release of Apache.NMS.ActiveMQ 1.2.0 is done. This version is a major update over 1.1.0 and include a lot of great new features as well as many fixes. You can download the source or binary bundles from here.

Changes in this version include:
  • Support for ConnectionMeteData in the Connection API.
  • Supports the new Individual Acknowledge Mode.
  • New IStreamMessage support
  • New IRedeliveryPolicy interface and PrefecthPolicy support.
  • Expanded IByteMessage interface to read/write primitive types.
  • Message's adhere to the JMS Read only and Write only rules.
  • Many new Unit Tests added to the Test Suite.
  • Support for Message Body Compression.
  • Connection Inactivity Monitor.
  • Optional Asynchronous Reconnects in the Failover Transport.
  • Optional Timeouts for Dispose and Close of Sessions.
  • Many more bugfixes and improvements as well.

Monday, February 8, 2010

First Release of NMS.Stomp is out.

Apache.NMS.Stomp v1.2.0 is now official, you can download the source and binary distributions here. This client is built on the v1.2.0 NMS API and requires that you download the binary distribution of NMS 1.2.0 as well.

The .NET Stomp client supports the .NET Compact Framework 2.0 and above and supports much of the NMS API. Support for MapMessage is implemented using XML and ActiveMQ's built in message transformation tools for stomp, see here.

Monday, January 18, 2010

First Release Candidate of NMS.Stomp is out.

The first official release candidate of NMS.Stomp is out, get it here:

This client offers support for the .NET Compact Framework 2.0+ along with the normal .NET 2.0+ and Mono 2.0+ support of the NMS client libs.