activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Snyder <>
Subject Re: how to create queue or topic at run time
Date Wed, 22 Sep 2010 17:38:19 GMT
On Wed, Sep 22, 2010 at 6:18 AM, pp <> wrote:
> Hi
> i m trying to create topic or queue at run time but it is giving a null
> pointer exception. can anyone give me a sample code for it.

Destination creation uses the session object like so:

// Create the connection
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(user, password, url);
connection = connectionFactory.createConnection();

// Create the session
Session session = connection.createSession(transacted,

// Create a queue
Destination destination = session.createQueue(subject);

// Create a topic
Destination destination = session.createTopic(subject);

This code is taken directly from the examples that come with ActiveMQ.
Here's the SVN URL to the examples:

perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"

ActiveMQ in Action:

View raw message