[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ack now or too lat - weird behaviour of transaction on ActiveMQ over stomp

I use stomp (1.2) to connect to ActiveMQ (5.15). It is a Python client and library is employed. A transaction begins when one message is received, the client does some processing then acknowledge the message, then commit the transaction. Such loop starts over when a new message is received.

There is a scenario where I found the problem. There could be more then one messages are received before the transaction begin-process-ack-commit loop. And such loops handle only one message in one go. What is the issue? The second message received earlier will not be acknowledged at all.

Pseudo code:
>>class mylistener:
>>  def on_message(self, header, body):
>>    print(‘get message %s’, header[‘ack’])
>>conn.set_listener(‘listener1’, mylistener());
>>conn.subscribe(destination=‘queue1', id=1, ack=‘client-individual’)
>>get message ID:03367ac6c23d-44027-1542285031966-10:1
>>get message ID:03367ac6c23d-44027-1542285031966-10:2
>>txid1 = conn.begin()
>>conn.ack(‘ID:03367ac6c23d-44027-1542285031966-10:1’, txid1)
>>txid2 = conn.begin()
>>conn.ack(‘ID:03367ac6c23d-44027-1542285031966-10:1’, txid2)

At this point, the second message is not acknowledged at all. You will find out it stays in the queue and will not be redelivered (if the client is not disconnected).

Anyone can tell me is this designed? I don’t see any statement like this in stomp spec. It looks quite problematic for me.

Best regards,

Murphy Meng
Sent from Polymail<>

Murphy Meng
API Software Developer
murphy.meng@xxxxxxxxxxx /
96 Great Suffolk Street, London, SE1 0BE, GB


Next Gen Advertising Award winner, Content Innovation Awards.
Best Video Marketing & Advertising Platform winner, Digiday Technology Awards.
Take a look to see what Mirriad In-Video Advertising<> can do for your business.

This message contains confidential information and is intended only for the individual(s) addressed in the message.
If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail.
If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.