-
1. Re: Pub/sub pattern with Core APIs
timfox Oct 30, 2009 1:01 PM (in response to simonallaway)Core does not distinguish between publish subscribe and point to point messaging, since, in effect, point to point is just a special case of pub sub where there's only one subscriber.
With core, if a message is sent to an address, then all queues bound to that address will receive that message. That gives you pub-sub. This is discussed a bit in the user manual, section on messaging concepts. -
2. Re: Pub/sub pattern with Core APIs
simonallaway Nov 2, 2009 2:20 PM (in response to simonallaway)Tim, thank you for that pointer. I am clearer now on how to create a producer that sends to a specific address, but I am having trouble creating consumers that use a specific address.
I want to be able to send messages on arbitrary addresses that appear out of thin air, with a hierarchical structure such as:
type.thing.1
type.thing.2
And then I'd want to create consumers that could receive messages on any number of or just one of those. I can't find a method in the ClientSession that lets me specify an address 'pattern' using wild-cards (or not, as the case may be). I see the filter expression parameter, but that doesn't seem to do what I want.
Can you point me to that part of the API or an example?
Thanks,
Simon -
3. Re: Pub/sub pattern with Core APIs
timfox Nov 2, 2009 2:37 PM (in response to simonallaway)You don't create a consumer on the address, you create it on a queue (see the ClientSession api).
When you create a queue on an address, you can specify a wildcard for the adress and the queue will retain any messages sent to any matching addresses.
It's like this
address --------0..* queues ----- 0..* consumers
I.e. an address can have zero or more queues.
A queue can have zero or more consumers -
4. Re: Pub/sub pattern with Core APIs
timfox Nov 2, 2009 2:40 PM (in response to simonallaway)I recommend having a look at this chapter in the user manual:
http://hornetq.sourceforge.net/docs/hornetq-2.0.0.BETA5/user-manual/en/html/using-core.html#d0e1229