A Session object is meant to be used by a single thread at any point.
You could specify multiple sessions (one for each thread),
or you could protect the access with synchronized blocks (you would be making it single thread on this case). I mean.. you could but you shouldn't... just create one for each thread.
2. Same as above... use multiple sessions. You can also use Message Listeners.
When you say server and consumer on the same process, I assume you're talking about embedding the server? We do that all the time. It's part of the docs and there are a few examples doing it.
3. Look at the DLA (Dead Letter Address) documentation. I'm not sure if you have a more specific question. Maybe you could ask something more specific?
Thanks for taking time to respond.
As you have mentioned it is better that each thread should have its own session, does it mean that the following handles should be created every thread
or the client session factory can be shared by multiple threads to create individual instances of ClientSession per thread.
What about the client consumer - can we use a single client consumer instance with N multiple threads to process that one queue ????
On Redelivery -
Ideally we would like to configure the AddressSettings for each queue with a redeliveryDelay of N minutes and MaxDeliveryAttempts say 10.
Say when we consume an item from the queue and if there is a failure to process that queue item - in this case we would like to not ACK.
What should be done in the code to to get this redelivered if we don't want to ack (based on the address settings). Should we do session.rollback ???
Also we would like to get the current number of delivery count when we get the queue item so we could do some action on our end before this goes to DLA.
Thanks in advance.