Should a JMS application create a new session for each message it sends?

Should a JMS application create a new session for each message sent, or is it preferable to create a session for a long message sequence?

+3
source share
2 answers

I would say no at all, although it really depends on the context and how you logically think of the connections in your application.

If messaging is a random one-time thing and subsequent messages are completely unrelated, then yes, if you can bear the cost.

If you have a long and logical sequence of interaction, it makes sense to do this during the session until you ruin your thread.

, .

:

:

* It is a factory for its message producers and consumers.

* It supplies provider-optimized message factories.

* It supports a single series of transactions that combine work

.

* It defines a serial order for the messages it consumes and the

, .

* It retains messages it consumes until they have been acknowledged.

* It serializes execution of message listeners registered with its

.

+5

Sun , .

+1

Source: https://habr.com/ru/post/1742170/


All Articles