use of jakarta.jms.QueueConnection in project spring-framework by spring-projects.
the class SingleConnectionFactoryTests method testWithQueueConnectionFactoryAndJms102Usage.
@Test
public void testWithQueueConnectionFactoryAndJms102Usage() throws JMSException {
QueueConnectionFactory cf = mock(QueueConnectionFactory.class);
QueueConnection con = mock(QueueConnection.class);
given(cf.createQueueConnection()).willReturn(con);
SingleConnectionFactory scf = new SingleConnectionFactory(cf);
Connection con1 = scf.createQueueConnection();
Connection con2 = scf.createQueueConnection();
con1.start();
con2.start();
con1.close();
con2.close();
// should trigger actual close
scf.destroy();
verify(con).start();
verify(con).stop();
verify(con).close();
verifyNoMoreInteractions(con);
}
use of jakarta.jms.QueueConnection in project spring-framework by spring-projects.
the class TransactionAwareConnectionFactoryProxy method createQueueConnection.
@Override
public QueueConnection createQueueConnection(String username, String password) throws JMSException {
ConnectionFactory target = getTargetConnectionFactory();
if (!(target instanceof QueueConnectionFactory)) {
throw new jakarta.jms.IllegalStateException("'targetConnectionFactory' is no QueueConnectionFactory");
}
QueueConnection targetConnection = ((QueueConnectionFactory) target).createQueueConnection(username, password);
return (QueueConnection) getTransactionAwareConnectionProxy(targetConnection);
}
Aggregations