-
1. Re: Divert to multiple destinations
jmesnil Jul 20, 2012 3:55 AM (in response to pacodelucia)pacodelucia wrote:
What I'm trying to do is somehow implement a topic with queues on the hornetq server.
- I have a queue A where message are written to by a client
- I would like to have two queues B and C (at the moment) where the messages that are written to A are forwarded. In the future I would like to have more Queues.
- The message in A should be deleted after copying it to B and C.
is JMS a requirement? If you are able to use HornetQ core API, it's much simpler:
* the sender sends messages to an address A
* HornetQ server creates multiple queues B, C, D bound to address A
* each consumer consumes from its own queue (B, C, or D)
-
2. Re: Divert to multiple destinations
pacodelucia Jul 20, 2012 7:46 AM (in response to jmesnil)Thanks for your reply. Yes, JMS is a requirement. Isn't it possible to do something like this with JMS? I mean JMS is just to write and read from the queues but what you do inside hornet can be done regardless of JMS or am I wrong? A divert for example is not JMS but still I can access my queues using JMS.
Thanks
-
3. Re: Divert to multiple destinations
ataylor Jul 20, 2012 8:16 AM (in response to pacodelucia)I think what Jeff is saying is this, using JMS when we create a queue it gets a default address of the same name, so jms.queue.myQ would have an address of jms.queue.myQ. since a divert diverts to an address it can only be forwarded to 1 queue. However if using core you can bind any core queue to any address, so you can have multiple queues all on the sane address (this is how topics are implemented).
-
4. Re: Divert to multiple destinations
mlange Oct 30, 2012 3:43 AM (in response to jmesnil)Hi jeff,
I have tried to implement this concept with a simple example. But I can't get it to run as expected.
I have created a queue which has multiple bindings configured:
Deployed queue: abo
Binding: abo.binding.1
Binding: abo.binding.2
Binding: abo.binding.3
Binding: abo.binding.4
I am sending messages to the "jms.queue.abo" address using core. Ok so far. You mentioned "each consumer consumes from its own queue (B, C, or D)". Is it possible to consume now from the four address bindings e.g. "abo.binding.1"? Is core a requirement on the consumer side as weil?
Thanks,
Marek
-
5. Re: Divert to multiple destinations
ataylor Oct 30, 2012 5:56 AM (in response to mlange)I have created a queue which has multiple bindings configured:
Deployed queue: abo
Binding: abo.binding.1
Binding: abo.binding.2
Binding: abo.binding.3
Binding: abo.binding.4
Marek, this doesn't really make sense, its not queues that have bindings it addresses, and its the queue that is the binding, so for instance:
<queue name="abo.binding.1">
<address>abo</address>
</queue>
would bind the queue abo.binding.1 to the address abo
-
6. Re: Divert to multiple destinations
mlange Oct 30, 2012 6:04 AM (in response to ataylor)Hi Andy,
yes I realized this as well. Thanks for clarifying.
Regarding my second question: can we use plain JMS for consuming from these specific queues, e.g. "abo.binding.1"? Or is the core API also needed on the consumer?
Thanks,
Marek
-
7. Re: Divert to multiple destinations
ataylor Oct 30, 2012 6:10 AM (in response to mlange)Regarding my second question: can we use plain JMS for consuming from these specific queues, e.g. "abo.binding.1"? Or is the core API also needed on the consumer?
The JMS layer just uses the core API under the covers, so yes in theory you will be able to use JMS, however the destinations won't be bound in JNDI and you would have to follow the jms naming conventions for destinations, i.e. jms.queue.foo etc
-
8. Re: Divert to multiple destinations
mlange Oct 30, 2012 9:21 AM (in response to ataylor)In theory yes. I tested with different combinatons but sending to an address using core api and receiving through plain JMS does not work.
Two queues:
<queue name="abo"> <address>jms.queue.abo</address> <durable>false</durable> </queue> <queue name="abo.fezadm.live"> <address>jms.queue.abo</address> <durable>false</durable> </queue> Sending to "jms.queue.abo" (core API). Receiving from "abo.fezadm.live" (plain JMS). No message is received.
When consuming from "abo" it works. What am I doing wrong?
Thanks,
Marek
-
9. Re: Divert to multiple destinations
ataylor Oct 30, 2012 9:35 AM (in response to mlange)can you post/attach your config and example code please and i will take a look
-
10. Re: Divert to multiple destinations
mlange Oct 31, 2012 8:51 AM (in response to ataylor)Hi Andy,
I wanted to test this first on integration using JBoss EAP6. I only had tested this using the embedded JMS hornetq server. Unfortunately the next problem occured: we are using the HornetQ RA to connect from JBoss EAP4 to the JBoss EAP HornetQ. Therefore we are using a pooled JMS XA Connectionfactory inside the appserver. The question is: is it possible to use the HornetQ Core API in this combination or is just plain JMS supported:
java.lang.ClassCastException: org.hornetq.ra.HornetQRAConnectionFactoryImpl cannot be cast to org.hornetq.jms.client.HornetQConnectionFactory
I can move this question to another thread of course.
And sending to a core address is also possible with EAP6 as JMS server? I did not see any configuration as we have it in hornetq-configuration.xml where the address is part of the queue definition. In domain.xml messaging subsystem there are only jms-destinations configured....
Thanks a lot for your input!
-
11. Re: Divert to multiple destinations
ataylor Oct 31, 2012 9:17 AM (in response to mlange)I wanted to test this first on integration using JBoss EAP6. I only had tested this using the embedded JMS hornetq server. Unfortunately the next problem occured: we are using the HornetQ RA to connect from JBoss EAP4 to the JBoss EAP HornetQ. Therefore we are using a pooled JMS XA Connectionfactory inside the appserver. The question is: is it possible to use the HornetQ Core API in this combination or is just plain JMS supported:
no the RA connection factories are the Application Servers not HornetQ altho they do use HornetQ under the covers.
And sending to a core address is also possible with EAP6 as JMS server? I did not see any configuration as we have it in hornetq-configuration.xml where the address is part of the queue definition. In domain.xml messaging subsystem there are only jms-destinations configured....
As far as i know you can configure core addresses, it should be the same, unless there is a bug (thid is AS7 code not HQ)
-
12. Re: Divert to multiple destinations
jmesnil Oct 31, 2012 9:35 AM (in response to mlange)Marek Neumann wrote:
And sending to a core address is also possible with EAP6 as JMS server? I did not see any configuration as we have it in hornetq-configuration.xml where the address is part of the queue definition. In domain.xml messaging subsystem there are only jms-destinations configured....
You can also configure core queues in the AS7 configuration files. For example:
<core-queues>
<queue name="myQueue">
<address>myAddress</address>
</queue>
</core-queues>
-
13. Re: Divert to multiple destinations
mlange Oct 31, 2012 10:20 AM (in response to ataylor)no the RA connection factories are the Application Servers not HornetQ altho they do use HornetQ under the covers.
Is my assumption correct that the advantage to use the JMS Connection Factory from the appserver only provides pooling mechanisms? XA transaction support can also be realized using the HornetQ XA Connection Factory?
-
14. Re: Divert to multiple destinations
ataylor Oct 31, 2012 10:22 AM (in response to mlange)Is my assumption correct that the advantage to use the JMS Connection Factory from the appserver only provides pooling mechanisms?
correct
XA transaction support can also be realized using the HornetQ XA Connection Factory?
Yes, it supports XA but you would have to enlist it with the transaction manager yourself if you did it that way