Long lived JMS sessions. Is Keeping JMS connections / JMS sessions always opened a bad practice?

前端 未结 5 677
野性不改
野性不改 2021-02-14 08:25

Is keeping JMS connections / sessions / consumer always open a bad practice?

Code draft example:

// app startup code

ConnectionFactory cf = (ConnectionF         


        
5条回答
  •  孤街浪徒
    2021-02-14 09:10

    The choice of keeping connection/session/producer/consumer open for long or not should be based on the frequency at which producer/consumer sends/receives messages.

    If a producer sends or a consumer receives messages frequently then the connections/sessions/producer/consumer should be kept open. On the other hand if messages send/receive is infrequent then it is not good keeping these JMS objects open will consume system resources like sockets.

提交回复
热议问题