<p>I have an ActiveMQ Artemis queue consumer and the client id is set as hostname. This runs on kubernetes as replicaset. Now the problem is whenever a pod crashes it gets assigned new hostname and the consumer loses its state on the broker. Is there a way I can keep a consistent client id throughout the pod life-cycle? Is there a way I can all the client ids from the broker so that I can assign from a known id from an id pool?</p>

<p>If you're consuming from a queue there's no need to set the client ID. Your app can just recreate the consumer on the queue and read all the messages which accumulated while it was disconnected (assuming another consumer didn't get them already). The client ID is really only useful if you're creating a durable subscription on a topic. As noted in section 6.1.2 of the JMS 2 specification:</p>
<blockquote>
<p>The only use of a client identifier defined by JMS is its mandatory use in
identifying an unshared durable subscription or its optional use in
identifying a shared durable or non-durable subscription.</p>
</blockquote>
