On 2/6/07, Suchitha Koneru (sukoneru) <[EMAIL PROTECTED]> wrote:
Thank you so much James.
Which version of active mq support durable subscriptions,

All of them since 1.0


As of now, I am using the following jars , in regard to active mq

activemq-core-4.0.1.jar
backport-util-concurrent-2.1.jar
geronimo-j2ee-management_1.0_spec-1.0.jar
geronimo-jms_1.1_spec-1.0.jar
incubator-activemq-4.0.2.jar


Please let me know, if I am understanding it correctly.
1) First approach
  Configuring durable subscriptions  on the ActiveMQConnectionFactory
object.
In the conf/context.xml  , I'll add the clientID as follows

<Resource name="jms/ConnectionFactory"
                        auth="Container"

type="org.apache.activemq.ActiveMQConnectionFactory"
                        description="JMS Connection Factory"
                factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                brokerURL="tcp://localhost:61616"
                brokerName="LocalActiveMQBroker"
                clientID = "CMD"
                />

2) Second Approach
      The code that creates the Connection can specify the ClientID
before calling start();

 Ictx = new javax.naming.InitialContext();
envContext = (Context)Ictx.lookup("java:comp/env");
//lookup the connection factory
javax.jms.TopicConnectionFactory factory =
(javax.jms.TopicConnectionFactory)envContext.lookup("jms/ConnectionFacto
ry");
HerbieConnection = factory.createTopicConnection();
HerbieConnection.setClientID("CMD");
HerbieConnection.start();

Yes - either of those is fine.

Also remember to use the right JMS API to create a durable subscriber,
giving a unique subscriber name too

http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Session.html#createDurableSubscriber(javax.jms.Topic,%20java.lang.String)

Its the combination of clientID and subscriber name which identify the
durable subscription. (And the JMS spec insists that clientID must be
globally unique - an attempt to create 2 connections with the same ID
will cause the 2nd connection attempt to fail)

--

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

Reply via email to