From the course: Spring: Messaging with JMS

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Connection configuration using SingleConnectionFactory

Connection configuration using SingleConnectionFactory - Spring Tutorial

From the course: Spring: Messaging with JMS

Start my 1-month free trial

Connection configuration using SingleConnectionFactory

- [Instructor] Now let's look at configuring Spring's JMS Connections using Spring's SingleConnectionFactory and talk briefly about the reasons for use and what this offers. So the Javadoc on Spring's SingleConnectionFactory says a JMS ConnectionFactory adapter that returns the same connection from all create connection calls and it ignores calls to the close Connection.close according to the JMS connection model. This is perfectly thread-safe in contrast to example JDBC connections. The shared connection can be automatically recovered in case of an exception. So this can be done by setting the ReconnectedOnException to true. This is useful when needing to connect to multiple different MOMs which means supplying multiple connection factories and in turn would require multiple JmsTemplates to be configured. SingleConnectionFactory in combination only really makes sense for sharing a single JMS connection across multiple JMS listeners. This is not useful when messaging load increases…

Contents