if you are using hornetq-core api, you can create a queue with a filter or not, and then having multiple consumers with different filters.
with JMS, you are currently bound to a single consumer / filter per subscription. That's a JMS limitation on the API.
thanks Clebert. It doesn't look like these core filters can be dynamically changed however, they are setup on the queue or the consumer, and once setup can't be modified. I would like to the change the filter expression frequently. Or are you suggesting I setup multiple consumers each with a different filter? That could be alot of consumers to dynamically manage.
You would need to close the consumer and reopen it.
Say...if we allowed you to close / reopen the consumer... the performance impact would be exactly the same. The implementation would have to re-scan the queues, and you would need a round trip on the network until the messages would arrive back to your client.
My suggestion would be to keep the consumer as much as open as possible until you have to change the filter...
And be careful if you're not using the message system as a database. That tends to fail usually.. if you need a lot of filtering you probably need a Cache System (Infinispan) or a Database system.