spring-framework / org.springframework.jms.connection / ConnectionFactoryUtils / doGetTransactionalSession

doGetTransactionalSession

@Nullable open static fun doGetTransactionalSession(connectionFactory: ConnectionFactory, resourceFactory: ResourceFactory): Session

Obtain a JMS Session that is synchronized with the current transaction, if any.

This doGetTransactionalSession variant always starts the underlying JMS Connection, assuming that the Session will be used for receiving messages.

Parameters

connectionFactory - the JMS ConnectionFactory to bind for (used as TransactionSynchronizationManager key)

resourceFactory - the ResourceFactory to use for extracting or creating JMS resources

Exceptions

JMSException - in case of JMS failure

Return
the transactional Session, or null if none found

See Also
#doGetTransactionalSession(javax.jms.ConnectionFactory, ResourceFactory, boolean)

@Nullable open static fun doGetTransactionalSession(connectionFactory: ConnectionFactory, resourceFactory: ResourceFactory, startConnection: Boolean): Session

Obtain a JMS Session that is synchronized with the current transaction, if any.

Parameters

connectionFactory - the JMS ConnectionFactory to bind for (used as TransactionSynchronizationManager key)

resourceFactory - the ResourceFactory to use for extracting or creating JMS resources

startConnection - whether the underlying JMS Connection approach should be started in order to allow for receiving messages. Note that a reused Connection may already have been started before, even if this flag is false.

Exceptions

JMSException - in case of JMS failure

Return
the transactional Session, or null if none found