[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: discarding consumer messages.

timfox do-not-reply at jboss.com
Fri Jan 30 05:51:01 EST 2009


It's easier and more efficient to reject messages at the server and not the client.

What need is a header in a message HDR_SOLO_MESSAGE (or whatever).

I sent a stock price to the queue and set the HDR_SOLO_MESSAGE to the stock ticker symbol e.g. RHT.

When the queue receives the message, it checks to see if HDR_SOLO_MESSAGE is present, if so, it looks in its local map to see if there is already a message in the queue with the same value of HDR_SOLO_MESSAGE.

If not, then it just adds the message as normal to the queue as normal. If so, then it removes the older reference with that header value before adding it.

In such a way there will only be the latest message for each stock ticker value in the queue at any time. I.e. only the latets price would be available.

This can be done by subclassing QueueIpl and adding the map and extra check on routing.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205820#4205820

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205820



More information about the jboss-dev-forums mailing list