Migrating from ActiveMQ-CPP/CMS version 2.2 to 3.0

Migrating from ActiveMQ-CPP/CMS version 2.2.6 to 3.0.1 is very easy. There are only two minor problems to deal with.

First problem: exceptions

No idea what “N3cms12CMSExceptionE” is? Use getCause() on cms::CMSException
objects to get std::exception*. Do not call what() directly. Do not try to call what() from any base classes.

catch (cms::CMSException& e) {
    cout << e.getCause()->what() << endl;

And now “N3cms12CMSExceptionE” is “No Matching Factory Registered for format := tcp”.

Second problem: library initialization

“No Matching Factory Registered for format := tcp” suggests that library was not initialized properly or some protocol-related modules was not loaded. Version 3.0 (and above) requires explicit initialization of ActiveMQ library.

To fix this problem include activemq/library/ActiveMQCPP.h and call ActiveMQCPP::initializeLibrary().

#include <activemq/library/ActiveMQCPP.h>
// ...

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




This site uses Akismet to reduce spam. Learn how your comment data is processed.