java

Hi everybody!

I'm developing an application with JMS and jSMQ, and I have a question with the way of receving messages.

I need to get notified when a message arrives asynchronouslly, and I know how to do it, but what I want is not to receive the message, because I'll use it in another part of the application. I only want to get notified of the reception. Is there any way to do this? I've thought of storing the message in a database and work with it when I'll need it, but It would be better to keep the message in the queue, know that is there, and receive it when I want.

Thank you very much for your opinions.

[651 byte] By [tranceaddict] at [2007-11-25 18:25:56]
# 1

It's tough to say without knowing exactly what you are trying to do.

One approach is to use two destinations. Put the message on a queue (and maybe in this case you want the message to be persistent), and send a non-persistent notification message to a topic. You can listen on the topic for the notifications, then get the message off the queue.

Or you could use a QueueBrowser to scan the queue for messages that match some criteria to act as your notification. A QueueBrowser does not consume messages. But this is more of

a polling style of interaction.

If the queue is going to be large, and you want direct access to messages (as opposed to FIFO), then consuming the message and storing the message in a database may be a good approach.

Joe

jfddp at 2007-7-3 18:28:56 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 2
Ok, I will store the messages in a database to acces them. Thank you for your help.
tranceaddict at 2007-7-3 18:28:56 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...