RE: Durable consumers
"Tim Anderson" <tima-k+1zm/[email protected]>
| Newsgroups | gmane.comp.java.openjms.devel |
|---|---|
| Message-ID | <[email protected]> |
In OpenJMS, TopicSubscribers only receive messages published from the time that they were initially created. You should be able to administratively create a durable subscriber for the topic and then use TopicSession.createDurableSubscriber(topic, yourDurableSubscriberName, selector, ....) to receive the message when required. I haven't actually tried this approach - let me know if it works/doesn't work. The other alternative is to use queues. In OpenJMS, QueueReceivers receive all messages, regardless of when the receiver was created. You can construct QueueReceivers on the fly with a selector which selects the message you want. Regards, Tim -----Original Message----- From: openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org]On Behalf Of Wang Ting Sent: Friday, January 17, 2003 12:30 PM To: [email protected]; Sanjeev Aggarwal; openjms-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Subject: RE: [openjms-developer] Durable consumers Dear Tim, I am always thinking about this case: If I want to recieve a message which was already produced ( Meanwhile, the message filter is dynamic, and so I have to create the temporary subscirber/listener to recieve messages ), how can I do? 1) Maybe 'Durable' is the way to resolve it. However, it is useless that the application just creates a durable subscriber after the generation of the specified message. Finnally, I have to confirm that the time to register a tempory subscriber is prior to the generation of message. 2) How about the usage of TTL? Thanks. Best Regards, Wang Ting -----Original Message----- From: openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org]On Behalf Of Jim Alateras Sent: 2003年1月17日 4:05 To: Sanjeev Aggarwal; openjms-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Subject: RE: [openjms-developer] Durable consumers Hi, Currently I was using SonicMQ. In that if there is any durable consumer for a Topic, it was not necessary that messages should be persistent. SonicMQ itself sees, if there is any durable consumers for a Topic, it stores the messages until it delievers the messages to all of its durable consumers. But in OpenJMS , durable consumers of a Topic receives messages only if messages sent on that Topic are persistent. Is it OK, or I am doing something wrong. [jima] you should also be able to send persistent and non-persistent messages to duirable consumers. You can test it by doing the following 1. runconsumer.bat -topic topic1 -name sub1 2. runpublisher.bat -topic topic1 -count 1 3. runpublisher.bat -topic topic1 -count 1 -persistent In the consumer window you should see [1 of 0] JMSDeliveryMode=NON_PERSISTENT, Priority=3, JMSMessageID=ID:6532260848592745480 [2 of 0] JMSDeliveryMode=PERSISTENT, Priority=0, JMSMessageID=ID:P7292479881129131912