Hi 

First, I would like to thank to all the developers and contributors for
Camel - it's great and fun to use!

Now to the point:

I am implementing the Dynamic Recipient List (from the Enterprise
Integration Patterns). The purpose is to provide consumers with only the
messages they are interested in (sort of a selective subscription). I've
read there may be performance issues using the JMS message selectors -
that's why I am trying to do this.
I would also like to put some extra functionality around that, like
permission checking and make the subscription process more versatile but
that's a different story.

I would like to ask whether the following approach seems to be OK.

1) I have a "Control Channel" queue. When a client wants some messages it
sends a message into this queue. The message body contains the name-value
pairs for the headers of the messages the client is interested in.

2) The Control Channel consumer creates a "Subscription HashMap", whose keys
are the name=value hashcodes and the values are lists of the clients who
expressed the same interest. The hashmap is stored on the server.

Subscription HashMap example:

"name=foo".hashCode() ->
[activemq:temp:queue:client1,activemq:temp:queue:client2]
"name=bar".hashCode() -> [activemq:temp:queue:client1]
"name=baz".hashCode() -> [activemq:temp:queue:client2]

3) The client initiates creation of a temporary queue (using getEndpint
method). The queue name is composed of the "activemq:temp:queue:" prefix and
the client's name, for example "activemq:temp:queue:client1".

4) When a message arrives on the server, the hashcode is computed for the
message headers and an appropriate value from the Subscription HashMap is
used as recipientList (I am using a bean with @recipientList annotation)

Now my questions:

a) What is the correct (best practice) name of the client I should use? It
should be unique for a broker and any network of brokers, right? Is it OK to
use it for the temporary queue name?

b) How do I deal with dead clients? I mean the temporary queues should be
gone when a client disconnects, but the subscriptions still live in the
Subscription HashMap. Can I hook the Subscription HashMap processing to the
event of figuring out that the client died? How is Camel/ActiveMQ handling
dead recipients in the list?

c) I've read that the dynamic recipient list may be faster than using
message selectors. Provided that I would use only subscriptions of type:

activemq:temp:queue:client1?selector=name='foo' OR name='bar'
activemq:temp:queue:client2?selector=name='foo' OR name='baz'

which corresponds with the above Subscription HashMap, when would you expect
one solution to beat the other one? (measure: number of consumers, messages
per second etc.). Having about 200 consumers with 10 different selector
conditions at rate about 100 messages per second still gives similar results
for both solutinos.

Thank you very much.

Regards
        Vojtech


-- 
View this message in context: 
http://www.nabble.com/Dynamic-Recipient-List-and-Temporary-Queues-tp23203324p23203324.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.

Reply via email to