Saar peer
Saar peer

Reputation: 847

ActiveMQ : queue VS temporaryQueue

I am using ActiveMQ in order to communicate between servers.

Every server holds one queue in order to send messages and temporaryQueue per each thread in order to receive messages.

When i am using about ~>32 threads i am receiving

 Cannot publish to a deleted Destination: temp-queue: xxx

After a while.

When i change from temporaryQueue to "regular" queue everything works perfectly.

(session.createQueue(...) instead of session.createTemporaryQueue())

Why am i getting this error ?

Does it cost more me when i use "regular" queue ?

Upvotes: 0

Views: 1221

Answers (1)

Petter Nordlander
Petter Nordlander

Reputation: 22279

So implementing request reply using non temporary queues you need some way to correlate the response to a request. You can use the correlation-id header. Since you are not really supposed to create request-unique regular queues, but a fixed set of queues. Like ORDER.CONFIRMATION.RESPONSE or similar. So, it's less costly to use regular queues - IF you reuse them.

To read messages using multiple threads from a common response queue - use a message selector to select JMSCorrelationID header for your particular answer.

However you should be able to use temp queues as well. Your problem is likely some kind of usage issue - but the information provided does not give any clues as it reveals no implementation or analysis.

Upvotes: 1

Related Questions