durable topic subscriber (using EJB3 annotations)
josey Apr 17, 2006 9:45 PMI have researched this for a while now with no luck so here goes . . .
I am trying to deploy a durable topic subscriber using EJB3 annotations. The MDB is deployed fine and it processes messages fine as well. The issue is that the subscription is showing as non-durable (as seen in the JMX console when I look at the subscribers and there is no entry in the db table JMS_SUBSCRIPTIONS).
I am using jboss-4.0.4.CR2 with EJB3 - jboss-EJB-3.0_RC5-PFD and java 1.5.0_06-b05.
Here is code snippet where I define my MDB:
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"), @ActivationConfigProperty(propertyName="destination", propertyValue="topic/testDurableTopic"), @ActivationConfigProperty(propertyName="subscriptionDurability",propertyValue="Durable"), @ActivationConfigProperty(propertyName="clientID", propertyValue="subscriber3") }) public class TestSubscriber implements MessageListener { ... }
I have not changed the configuration of the testDurableTopic that comes with JBoss; it still persists to the Hypersonic database.
In the client application that I am using,
1. I set the publisher delivery mode as persistent [e.g., publisher.setDeliveryMode(DeliveryMode.PERSISTENT)]
and
2. I set the JMS delivery of the message [e.g., message.setJMSDeliveryMode(DeliveryMode.PERSISTENT)].
When I print out the message contents I see jmsDeliveryMode : 2 (e.g., PERSISTENT).
As mentioned above, I have been researching this for a while (days); I have read through a lot of documentation; I turned on debug tracing; I looked in the JMX console; etc. - but no luck.
The page that fits this topic well is out of date (found here): http://wiki.jboss.org/wiki/Wiki.jsp?page=WhatIsTheCorrectWayToMakeADurableSubscription
I was able to create a durable subscriber programmatically using
session.createDurableSubscriber(topic, clientId);
But this does not seem like the correct way to create durable MDB subscriber; this just created a different receiver. Please correct me if I am wrong but the annotations should allow me to create a durable subscriber without creating one programmatically as above.
Any help grealy appreciated. Thanks in advance.