-
1. Re: Selective message consumption - HOWTO?
ataylor Oct 21, 2012 5:44 AM (in response to gary002g)take a look at the message selector examples in the distro
-
2. Re: Selective message consumption - HOWTO?
gary002g Oct 22, 2012 6:36 PM (in response to ataylor)I am looking through the distribution examples.
There is no message selector there.
Only queue selector and topic selector which aren't applicable in my case.
-
3. Re: Selective message consumption - HOWTO?
ataylor Oct 22, 2012 6:44 PM (in response to gary002g)yes, both the topic and queue selector demonstrate how to use message selectors, maybe you mean something different.
-
4. Re: Selective message consumption - HOWTO?
clebert.suconic Oct 22, 2012 7:02 PM (in response to gary002g)as I constantly say: Be Careful with the Store-and-retrieve anti-pattern.
If you are expecting a specific message, it probably means you are using the message system as a storage system. You should probably use a database for that. Message systems are to send/receive messages in a disconnected way. I'm not saying this is what you're doing.. just that when I see people expecing specific message it usually means that.
-
5. Re: Selective message consumption - HOWTO?
gary002g Oct 22, 2012 7:37 PM (in response to ataylor)I am not using subscription model, so topic selector is not for me as consumed message must be removed from the queue.
I am not sure how queue selector can be used as this example uses listeners for a specific selector, i.e. it is sitting and waiting for a specific message to consume.
What I need is to create a generic consumer that receives a REST service call - "give me a message that matches my processing capabilities".
It is then suppose to retrieve such message and return it to the REST client. It is doing something else but that is beyond the point of discussion.
-
6. Re: Selective message consumption - HOWTO?
clebert.suconic Oct 22, 2012 8:02 PM (in response to gary002g)It is the same API basically.. I'm not sure what's your issue.
Anyway.. that's pretty much covered by the JMS tutorial.
-
7. Re: Selective message consumption - HOWTO?
gary002g Oct 22, 2012 8:56 PM (in response to clebert.suconic)It might be easy for you. For me JMS tutorial is absolutely useless in that regard.
Maybe I am looking at the different tutorial. Can you post a link to a proper page if you know it.
-
8. Re: Selective message consumption - HOWTO?
clebert.suconic Oct 22, 2012 10:35 PM (in response to gary002g)1 of 1 people found this helpfulThis is pretty much what you have to do:
Session session = ... something that creates the session...
Queue queue = session.createQueue("queueName"); // this will just lookup the queue
// Notice that Session can take either queue or a topic
MessageConsumer consumer = defaultSess.createConsumer(queue, "messageProperty=3");
if you were using Topics and wanted to use a durable subscription you would be able to add another property with the subscription name.
Then everything else is just the same as any other message consumer.. there are plenty of examples.
You should be able to do it that way. let me know if it helps.
-
9. Re: Selective message consumption - HOWTO?
gary002g Oct 23, 2012 5:40 PM (in response to clebert.suconic)Does HornetQ supports bitwise operations in the selector? I.e. if I have a message IntProperty with the value = 1, can I have
MessageConsumer consumer = defaultSess.createConsumer(queue, "messageProperty & 3");
Will that work?
-
10. Re: Selective message consumption - HOWTO?
clebert.suconic Oct 23, 2012 7:17 PM (in response to gary002g)no, but it seems a nice feature to be added
-
11. Re: Selective message consumption - HOWTO?
clebert.suconic Oct 23, 2012 7:18 PM (in response to gary002g)you could raise a JIRA if you like... or even better.. if you have some knowledge on antlr.. you could implement it on FilterParser.jj and submit a PR.
-
12. Re: Selective message consumption - HOWTO?
gary002g Oct 23, 2012 7:34 PM (in response to clebert.suconic)I'd love to but my manager is cracking the whip over my head to deliver on the project that should have not just me but at least 3 developers.