-
Dec 13th, 2008, 10:05 AM
#1
MDP and dynamic selector
Hi,
I have a use case where my application needs to listen to a JMS queue and dynamically alter its message selector during runtime. I have currently solved this by having a QueueConnectionFactory injected from which I in a thread safe manner maintain a single QueueReceiver that I close and recreate.
This appears to work well (though more testing is needed), but I'm slightly worried that I might need to have several receivers ready to make the application more concurrent.
This requirement of changing message selector during runtime, is this something that Spring can help me with? I have looked over the JavaDoc but could not find an obvious way to go about solving this.
Any help would be appreciated.
-
Dec 16th, 2008, 01:11 PM
#2
message selector is normally configured in XML for the MDB / MDPs. so it's not good idea to switch it dynamically. since u r using Q, if u have single subscriber, u can choose to not publish the message at publisher side based on the condition. else, if multiple subscribers are choosing from the queue (for some non-load-balancing reason), i guess u can't prevent the subscriber from first looking at the message. he can always look at the message and do nothing - the dynamically not selecting equivalent. if it is some other subscriber's message, then to give the other subscriber a chance to look at it, u would need to change the queue to topic, so both subscribers at least receive the message for them to peek at it. creating new receiver as u suggested can be resorted to if the dynamic selection switching is very infrequent.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules