9

I am confused between JMS Connection Pooling and JMS Session Pooling.

I have a Java application which has approximately 20 threads processing messages being received from a vendor product. Each thread peforms some processing of the message before pushing on to a JMS Topic(same topic for all 20 threads).

I want to ensure that there are no threads waiting for free JMS connections as performance is critical. However, when I look at the JMS Connection Factories I cannot see any way to configure a pool size for my JMS Connections.

Now I am really confused. Is it the JMS sessions I should be pooling?

Any help on this much appreciated

Thanks Joe

user1496620
  • 91
  • 1
  • 1
  • 2

2 Answers2

6

From the J2EE 6 api a javax.jms.Connection

typically represents an open TCP/IP socket between a client and the service provider software.

and

A Session object is a single-threaded context for producing and consuming messages.

A session (or a session pool) occurs in the context of a connection.

You probably want to determine whether to pool Sessions, Connections or neither of those based upon the cost of creating these resources from scratch in the context of your specific technology stack, frameworks and applications involved.

My resources:

Community
  • 1
  • 1
eebbesen
  • 5,070
  • 8
  • 48
  • 70
1

I know one method from PooledConnectionFactory class using which you can set the max number of connection. method is setMaxConnections. this is however part answer of your question.

Manglesh
  • 520
  • 1
  • 13
  • 29