-
1. Re: Multiple clients and message types - selectors?
clebert.suconic May 18, 2009 10:33 PM (in response to cpslo1999)I would use a topic and subscribers (durable if is the case) with selectors.
-
2. Re: Multiple clients and message types - selectors?
cpslo1999 May 18, 2009 10:58 PM (in response to cpslo1999)That's where I was headed...
I need to be able to also (re)send a notification to only one client (preferably using the same mechanism). I had thought I could have a selector that looks for my notifications of interest and/or notifications with a property set to the client's ID, but I don't know if it is possible to configure selectors that way (or better if there is another way to identify specific clients when I send messages).
Can I do this with topics? -
3. Re: Multiple clients and message types - selectors?
clebert.suconic May 19, 2009 10:31 AM (in response to cpslo1999)I don' t understand what you are trying to achieve... mainly here:
- I need to be able to also (re)send a notification to only one client
Can you try abstracting your business and explain what you are trying to achieve in pure JMS terms? -
4. Re: Multiple clients and message types - selectors?
cpslo1999 May 19, 2009 11:36 AM (in response to cpslo1999)Sure (and thanks so much for your help!).
I have what amounts to a store-and-forward system (let's call it the SAF for this discussion). It feeds multiple client systems. The SAF receives a number of files from different, external systems, which it stores and makes available via HTTP. The clients are each interested in some subset of these files (the subsets can and will overlap).
I am trying to design a communications mechanism that will allow the SAF to send asynchronous notifications to the clients when interesting files arrive. In most cases this will be done as the files arrive (perfect for a topic with client-side selectors), however, I also need to build in the ability to target one particular client from the SAF and re-play the notifications. Say I add a new client system, I need to be able to tell the SAF to send notifications to that new client for files that were received before the client was added (back-filling). Also, if a processing algorithm changes on one of the clients, I may need to send notifications for files that the client had processed once before (re-sending).
It is really this notion of targeting a single client that has me befuddled. Adding a new queue for each client administratively seems like a tight coupling and a fair amount of manual configuration overhead. Using a pure topic, I can't figure out how to provide this secondary feature of targeted playback.
Did that clarify the situation enough? -
5. Re: Multiple clients and message types - selectors?
clebert.suconic May 19, 2009 11:57 AM (in response to cpslo1999)I think you need a Topic with subscribers and selectors for the regular day-to-day operation.
And you also probably need a request mechanism on receiving the initial information. Maybe the client creates a temporary queue, send a request to receive the initial information, and the initial information comes on that queue.
On the day-by-day basis you would have the durable selector receiving the information.
I feel like spoiling the surprise suggesting you this :-) , but there is a great JMS example on JBoss Messaging 2 which explains what I' m suggesting to you in terms of Request-Reply:
svn co http://anonsvn.jboss.org/repos/messaging/trunk/examples/jms/request-reply
Look at the readme.. it bring a lot of information.
if you want to run the example:
svn co http://anonsvn.jboss.org/repos/messaging/trunk messaging
cd messaging
ant
cd examples/jms/request-reply
ant -
6. Re: Multiple clients and message types - selectors?
timfox May 19, 2009 12:00 PM (in response to cpslo1999)If you want a topic subscriber to receive all messages of a certain type and also receive all messages sent directly to it, can't you assign each subscriber an id and use a selector like:
messageType='FOO' OR destinationID=myid
-
7. Re: Multiple clients and message types - selectors?
cpslo1999 May 19, 2009 1:08 PM (in response to cpslo1999)clebert:
Thanks for the pointer, I've checked out the sample and started to look it over.
timfox:
If I deploy my app in an .ear file, wouldn't I have to muck around with the embedded deployment descriptors in each client in order to assign the unique IDs? I would love to be able to modify the selector at runtime so I can my application's existing configuration mechanisms, is that possible? -
8. Re: Multiple clients and message types - selectors?
clebert.suconic May 19, 2009 3:00 PM (in response to cpslo1999)"timfox" wrote:
If you want a topic subscriber to receive all messages of a certain type and also receive all messages sent directly to it, can't you assign each subscriber an id and use a selector like:messageType='FOO' OR destinationID=myid
It's a good idea but I don't think that would work for cpslo1999.
Say you send messageType="A", destinationID=myID
The other subsriber with messageType="A" , destinationID=2 will also receive this message, and from what I read this is not what he wanted.
It would be an idea though. -
9. Re: Multiple clients and message types - selectors?
timfox May 19, 2009 3:05 PM (in response to cpslo1999)I guess I'm not understanding what the user is trying to achieve here.
Also I don't understand why the selector needs to be dynamic. The id is the client id which can be in the deployment xml. -
10. Re: Multiple clients and message types - selectors?
cpslo1999 May 19, 2009 3:57 PM (in response to cpslo1999)Thank you guys for your help here!
timfox: Is there a way to specify the selector outside of the .ear file? I'm hesitant to require that the deployer of my application unzip the ear, change an ID, and rezip it. I would rather use a identical application package on our production and test servers and have other files, descriptors, or database settings tweaked to account for the environment. If that is possible with selectors, then that sounds like the least complicated solution. -
11. Re: Multiple clients and message types - selectors?
cpslo1999 May 20, 2009 7:23 PM (in response to cpslo1999)I think I can use Tim's suggestion (if I can find a way to assign the selector outside the ear).
Something like:clientID is NULL AND feed in ('feed1', 'feed2') OR clientID = 'myClientID' AND feed in ('feed1', 'feed2')
So is there a way for me to assign the clientID other than in the annotations of the MDB or in the embedded deployment descriptor? -
12. Re: Multiple clients and message types - selectors?
timfox May 21, 2009 4:40 AM (in response to cpslo1999)Well, as per JMS spec, JBoss Messaging lets you set the client id programmatically after creating a connection, and you can define and set selectors when creating a consumer.
However if you're using MDBs it's different, bear in mind MDBs are not part of JBM, they're part of the app server, and follow a different contract defined in the JEE spec. I'm not sure if that is possible, but you're best bet is to ask in the EJB forum. -
13. Re: Multiple clients and message types - selectors?
cpslo1999 May 21, 2009 8:35 AM (in response to cpslo1999)OK, thanks again for all your help. I'll post over there and see what I can dig up.