0

I've a simple Spring-boot application with JTA base on Atomikos Transaction Manager. It consumes messages from a queue and logs them. The problem is that after the 7th incoming message the rest of the message in the queue are dequeued but are not processed. I realized that this performance is looping, I mean:

  1. Inserted 10 messages in the queue.
  2. Processed and dequeued 1st message.
  3. Processed and dequeued 2nd message.
  4. Processed and dequeued 3rd message.
  5. Processed and dequeued 4th message.
  6. Processed and dequeued 5th message.
  7. Processed and dequeued 6th message.
  8. Processed 7th message and dequeued 7th,8th,9th and 10th messages.
  9. Inserted other 10 messages in the queue.
  10. Processed and dequeued 11th message.
  11. Processed and dequeued 12th message.
  12. Processed and dequeued 13th message.
  13. Processed and dequeued 14th message.
  14. Processed and dequeued 15th message.
  15. Processed and dequeued 16th message.
  16. Processed 17th message and dequeued 17th,18th,19th and 20th messages.

Moreover, I realized that without the transaction manager enabled it processes and consumes all the message in the queue.

Is there any bug or configuration that I forgot about that point?

You can find the full code on: https://github.com/PedroRamirezTOR/spring-jta-amq.git

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • The problem is that app doesn't process more than 7 enqueued messages if the messages are in the queue before starting the app. – Pedro Ramírez Pérez Nov 28 '18 at 16:18
  • Why are you using JTA if you're just consuming messages from a single message broker? – Justin Bertram Nov 28 '18 at 16:37
  • My full app will send the received messages to another broker. – Pedro Ramírez Pérez Nov 28 '18 at 16:45
  • I tried this and got the same problem. Due to this I tried to reduce the complexity of the example to find the problem. – Pedro Ramírez Pérez Nov 28 '18 at 16:46
  • Could you modify your git project to reproduce the problem you're seeing and also provide simple instructions to reproduce the problem in your question? – Justin Bertram Nov 28 '18 at 17:12
  • You can reproduce the problem if you have an ActiveMQ deployed on localhost and you insert 10 messages in a queue named QueuePrueba. Then you run the app and It logs only the seven first messages. – Pedro Ramírez Pérez Nov 28 '18 at 18:19
  • I realize that I could potentially reproduce the problem by setting the environment up manually and running your application. However, in the interest of time I would like to avoid manual (and error-prone) steps. The recommendation of Stack Overflow (and the rest of the industry in my experience) is that you provide a [minimal, complete, & verifiable example](https://stackoverflow.com/help/mcve). Your example appears to be minimal, but isn't complete therefore it isn't verifiable. – Justin Bertram Nov 28 '18 at 18:34
  • Ok, I will modify it and advise you. Thanks Justin! – Pedro Ramírez Pérez Nov 28 '18 at 18:35

1 Answers1

0

Thanks Justin! Finally, I was preparing the example to test easily the problem and I realized that situation only happens when we use ActiveMQ console to insert the messages. I prepared an REST api to insert a number of messages in one transaction and all of them were consumed and dequeued. I think It could be an ActiveMQ web console bug.

If anyone is interested can download the example from https://github.com/PedroRamirezTOR/spring-jta-amq.git