From the course: Spring: Messaging with JMS

Unlock the full course today

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

Connection configuration using CachedConnectionFactory

Connection configuration using CachedConnectionFactory - Spring Tutorial

From the course: Spring: Messaging with JMS

Start my 1-month free trial

Connection configuration using CachedConnectionFactory

- [Instructor] CachingConnectionFactory is the third way we look at configuring a connection to a MAM. The CachingConnectionFactory is a subclass of the SingleConnectionFactory. It too returns the same connection for all creatConnection calls, as well as ignores Connection.close. CachingConnectionFactory, similarly, is thread-safe and the spring API says that RecconectonException flag is defaulted to true for CachingConnectionFactory, which is the opposite of the single connection factory. The CachingConnectionFactory allows optionally caching of consumers and producers. On startup, if not changed, it will only cache one session, but you can however change this session size. Let's open our JMS config, and locate the connection factory. We'll change our return type from SingleConnectionFactory to... CachingConnectionFactory. We'll also change the SingleConnectionFactory object to CachingConnectionFactory. We'll comment out the set reconnect on exception, because this is set to true by…

Contents