AmanSinghal
AmanSinghal

Reputation: 2494

ActiveMQ, multiple session vs multiple connection

I want to use ActiveMQ in my current project, however I am little confused as to when to take advantage of multiple connections. Since we can create multiple producers in a single connection, then whats the need of having multiple connections.

I tried to find it online but unable to find any useful resource which can help me to understand it in depth.

It would be really helpful if someone can share his practical experiences of working with activemq and help us in understanding, when to create multiple connections for each producer and when to create multiple producer in a same connection.

Upvotes: 4

Views: 2570

Answers (1)

Matt Pavlovich
Matt Pavlovich

Reputation: 4316

Connections:

  • Useful for multi-threaded applications to increase overall throughput.
  • Separation of identity for authn and authz (user: "tickets" vs user: "billing")

Sessions:

  • Separation of transaction boundaries

Multiple Producers / Consumers

  • Allow for working with multiple destinations
  • Multiple consumers allow for parallel processing
  • Limited value in multiple producers in most use cases

Note: In JMS 2.0, the JMSContext provides what is essentially a combined connection+session.

Upvotes: 4

Related Questions