You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by guillermolalsacien <gu...@sun.com> on 2006/04/04 12:03:48 UTC

Dynamic Topic or just Temporary topic ?

I need to create Topics dynamically with the following code:

Topic topic = null;
connectionFactory = new ActiveMQConnectionFactory( PROVIDER_URL  );
Connection connection = connectionFactory.createConnection();
Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);        
topic = s.createTopic(name);

I have checked in the JConsole that the topic was succesfully created.
I run this code in another to machine to locate the Topic:

Topic topic = (Topic) ctx.lookup("dynamicTopics/" + name);

It also works fine, the problem is that when I stop the broker the Topic
isn't there once restarted.

So my question is what is the difference between a temporary topic and this
kind of topic ? How can I create and share a dynamic topic and make it last
? 

I've also seen in the documents that it is possible to bind destinations in
the JNDI context like other JMS providers do, but since it is a
ReadOnlyContext how should I do that ?
--
View this message in context: http://www.nabble.com/Dynamic-Topic-or-just-Temporary-topic--t1392171.html#a3741731
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Dynamic Topic or just Temporary topic ?

Posted by James Strachan <ja...@gmail.com>.
A temporary topic exists only on one client JVM and ceases to exist
when the client goes away.

A topic can be created at any time in various ways (using
createTopic(), JNDI or JMX).

Only topics with persistent messages on them survive broker re-starts.
For non-durable topics, they are just created on demand first time
they are used.

James

On 4/4/06, guillermolalsacien <gu...@sun.com> wrote:
>
> I need to create Topics dynamically with the following code:
>
> Topic topic = null;
> connectionFactory = new ActiveMQConnectionFactory( PROVIDER_URL  );
> Connection connection = connectionFactory.createConnection();
> Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> topic = s.createTopic(name);
>
> I have checked in the JConsole that the topic was succesfully created.
> I run this code in another to machine to locate the Topic:
>
> Topic topic = (Topic) ctx.lookup("dynamicTopics/" + name);
>
> It also works fine, the problem is that when I stop the broker the Topic
> isn't there once restarted.
>
> So my question is what is the difference between a temporary topic and this
> kind of topic ? How can I create and share a dynamic topic and make it last
> ?
>
> I've also seen in the documents that it is possible to bind destinations in
> the JNDI context like other JMS providers do, but since it is a
> ReadOnlyContext how should I do that ?
> --
> View this message in context: http://www.nabble.com/Dynamic-Topic-or-just-Temporary-topic--t1392171.html#a3741731
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


--

James
-------
http://radio.weblogs.com/0112098/

Re: Dynamic Topic or just Temporary topic ?

Posted by James Strachan <ja...@gmail.com>.
On 4/4/06, James Strachan <ja...@gmail.com> wrote:
> I forgot to answer your last question...
>
> On 4/4/06, guillermolalsacien <gu...@sun.com> wrote:
> > I've also seen in the documents that it is possible to bind destinations in
> > the JNDI context like other JMS providers do, but since it is a
> > ReadOnlyContext how should I do that ?
>
> Well you can bind ActiveMQ resources (ConnectionFactory, Queue,
> Destination objects) to any JNDI provider. Or we provide a JNDI
> provider which parses the contents of the jndi.properties file to
> create the resources in the context for you.
>
> http://activemq.org/JDBC+Support

Butter fingers; I meant...
http://activemq.org/JNDI+Support

:)

--

James
-------
http://radio.weblogs.com/0112098/

Re: Dynamic Topic or just Temporary topic ?

Posted by James Strachan <ja...@gmail.com>.
I forgot to answer your last question...

On 4/4/06, guillermolalsacien <gu...@sun.com> wrote:
> I've also seen in the documents that it is possible to bind destinations in
> the JNDI context like other JMS providers do, but since it is a
> ReadOnlyContext how should I do that ?

Well you can bind ActiveMQ resources (ConnectionFactory, Queue,
Destination objects) to any JNDI provider. Or we provide a JNDI
provider which parses the contents of the jndi.properties file to
create the resources in the context for you.

http://activemq.org/JDBC+Support
--

James
-------
http://radio.weblogs.com/0112098/