-
1. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
igarashitm May 28, 2013 11:02 AM (in response to tadayosi)Hi Sato-san,
HornetQMixIn doesn't do anything Queue specific except getJMSSession() method. Once you get a JMS Session from HornetQMixIn via getJMSSession(), then you should be able to publish/subscribe via that Session with using Session.createProducer(), Session.createConsumer() or Session.createDurableSubscriber().
There isn't getJMSTopic() on HornetQMixIn right now but you can simply call new HornetQTopic(topicName) instead like getJMSQueue() is doing.
Please let me know if there's any problem around these.
Thanks,
Tomo
-
2. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
igarashitm May 28, 2013 6:28 PM (in response to igarashitm)Oops - I meant getJMSQueue() method is the one doing Queue specific.
-
3. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
tadayosi May 29, 2013 12:16 AM (in response to igarashitm)Thank you for the inputs, Igarashi-san!
I'll investigate that and update the results. For confirmation, to create a non-durable subscriber for a Topic you just need to cast HornetQMixIn.createJMSSession() to TopicSession. Is that correct?
Regards,
Tadayoshi
-
4. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
igarashitm May 29, 2013 1:45 AM (in response to tadayosi)1 of 1 people found this helpfulLogically nope, you don't have to acquire TopicSession. You should be able to use generic Session, MessageProducer and MessageConsumer for Topic as well. Please take a look at JMS 1.1 Spec section6, Table6-1. JMS Common interfaces are preferred than Pub/Sub Domain specific interfaces. I have never tried that though... It should be a bug if it doesn't work
-
5. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
tadayosi May 29, 2013 3:27 AM (in response to igarashitm)Thanks, Igarashi-san.
I tested that, but it looks like there is a problem only in outbound Topics (SCA references with Came JMS Binding); actually I could send messages to inbound Queues/Topics and receives messages from outbound Queues with Camel JMS Binding. Considering there exists no quickstart example of using JMS Topics as SCA references, I suspect no one yet tries such configuration
-
6. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
tadayosi May 29, 2013 4:01 AM (in response to igarashitm)Just for completeness, I've filed a feature request to add getJMSTopic() method to HornetQMixIn.
-
7. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
tadayosi May 29, 2013 4:43 AM (in response to tadayosi)> it looks like there is a problem only in outbound Topics (SCA references with Came JMS Binding)
I've attached the reproducer project. Please just run 'mvn test' under the helloworld_topic_notifier project, then you'll see a test fails. Should I raise a JIRA as a bug, or do I miss something?
Thank you!
-
outbound-topic-not-work.zip 11.2 KB
-
-
8. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
igarashitm May 29, 2013 5:49 AM (in response to tadayosi)1 of 1 people found this helpfulI guess the message is disposed by HornetQ server before it's received by consumer just because there's no active/durable subscriber at the moment. You may need to register MessageListener before the message is sent to the Topic.
-
9. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
igarashitm May 29, 2013 5:57 AM (in response to tadayosi)Cool, thanks!
-
10. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
tadayosi May 29, 2013 8:29 AM (in response to igarashitm)AHHH, you are absolutely right! With that change, it works as expected now. Thank you for all the advices here.
-
11. Re: How to publish/subscribe Topic messages using HornetQMixIn in unit tests
igarashitm May 29, 2013 8:50 AM (in response to tadayosi)glad to hear it works