Skip to content
Advertisement

ActiveMQ Artemis queue deleted after shutdown of consuming client

I am newbie on JMS and ActiveMQ Artemis, and I have the following problem. I put a message in a requests queue normally from an application producer: put message

After that from other application consumer I tried to consume that message. That works without problems.

But when I shutdown the application consumer the request queue was deleted for no reason. after consume message

My application consumer was build with Spring Boot as follows:

JavaScript
JavaScript

BTW, the original requests queue was created when the application producer sent the message to ActiveMQ Artemis and this was done with JMSTemplate as follow:

JavaScript

If I shutdown the application producer the requests queue is not deleted. The queue is only deleted when I shutdown the application consumer using @JMSListener.

Please help me. Maybe I miss some understanding or parameter?

Advertisement

Answer

What you’re observing is expected as this is the default behavior of ActiveMQ Artemis. Addresses and queues are automatically created and deleted. Addresses and queues are created in response to a client sending a message or a client creating a consumer. Once there are no more messages in the queue and the last consumer disconnects the queue is removed as it’s no longer needed. When there are no more queues bound to an address then it is removed as well. These resources will be re-created again if necessary.

You can control this behavior with the following address settings:

  • auto-create-queues
  • auto-delete-queues
  • auto-create-addresses
  • auto-delete-addresses

You can fine tune the behavior with the following address settings:

  • auto-delete-queues-delay
  • auto-delete-queues-message-count
  • auto-delete-addresses-delay

See the documentation for more details.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement