Jan 30th, 2013, 07:03 PM
Messages that do not meet selector criteria are removed from Topic
I am new to all this, so bear with me please
I am using VB .NET and Spring to access topics from JMS, I have written an application to read/write to a topic using durable subscribers (listener), messages are sent as "peristent" and I added a property and a value, listeners filter (selector) by the added message property, this part works fine, if I have multiple durable subscribers to the same topic and each has its own selector (filter), if all the subcribers are connected (listening), each subcriber get its corresponding filtered messages, this also works fine. The problem is when one of the subscribers stops listening (but still connected) and messages for him are sent to the topic and when the subcriber starts listening again, there are no messages for him when they should.
I think that maybe the other subcriber removes the messages that do not match its selector, I am not sure why this happens, can someone help? Hope I made myself clear on my problem.
Jan 31st, 2013, 01:11 PM
I figured the problem out, the issue that I was thinking was the problem was true, the listener was checking all messages and returning only the ones that matched the selector and the ones that did not match were being removed from the queue, I got this fixed by setting the "AcknowledgementMode" to "ClientAcknowledge" both in the listener an in the sender's "connection", I am receiving messages by calling "ReceiveNoWait" (here is where I think part of my problem was) of the "consumer", only when messages are received I send an "Acknowledge", so any other message read does no and stays in the queue.
This is how I send the Acknowledge
Dim textMessage As ITextMessage = consumer.ReceiveNoWait()
textMessage.Acknowledge() <--- Only if the message received is <> Nothing or matches my selector
Hope this helps someone and makes sense, let me know if you need me to clarify anything if you have a similar problem.
Tags for this Thread