Search in sources :

Example 11 with RMQConnectionFactory

use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.

the class RequeueMessageOnTimeoutIT method connection.

private QueueConnection connection(boolean requeueOnException, boolean requeueOnTimeout) throws Exception {
    RMQConnectionFactory connectionFactory = (RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory().getConnectionFactory();
    connectionFactory.setRequeueOnMessageListenerException(requeueOnException);
    connectionFactory.setRequeueOnTimeout(requeueOnTimeout);
    connectionFactory.setOnMessageTimeoutMs(REQUEUE_TIMEOUT_MS);
    QueueConnection queueConnection = connectionFactory.createQueueConnection();
    queueConnection.start();
    return queueConnection;
}
Also used : QueueConnection(javax.jms.QueueConnection) RMQConnectionFactory(com.rabbitmq.jms.admin.RMQConnectionFactory)

Example 12 with RMQConnectionFactory

use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.

the class RequeueMessageOnListenerExceptionIT method connection.

private QueueConnection connection(int qos) throws Exception {
    RMQConnectionFactory connectionFactory = (RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory().getConnectionFactory();
    connectionFactory.setChannelsQos(qos);
    connectionFactory.setRequeueOnMessageListenerException(true);
    QueueConnection queueConnection = connectionFactory.createQueueConnection();
    queueConnection.start();
    return queueConnection;
}
Also used : RMQConnectionFactory(com.rabbitmq.jms.admin.RMQConnectionFactory)

Example 13 with RMQConnectionFactory

use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.

the class SslContextIT method useDefaultSslContextWhenOptionIsEnabled.

@Test
public void useDefaultSslContextWhenOptionIsEnabled() throws Exception {
    RMQConnectionFactory connectionFactory = (RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory(true, 0).getConnectionFactory();
    SSLContext defaultSslContext = createSslContext();
    AlwaysTrustTrustManager defaultTrustManager = new AlwaysTrustTrustManager();
    defaultSslContext.init(null, new TrustManager[] { defaultTrustManager }, null);
    SSLContext.setDefault(defaultSslContext);
    connectionFactory.useDefaultSslContext(true);
    connection = connectionFactory.createConnection();
    assertTrue(defaultTrustManager.checkServerTrustedCallCount.get() >= 1, "TrustManager#checkServerTrusted must be called");
}
Also used : RMQConnectionFactory(com.rabbitmq.jms.admin.RMQConnectionFactory) SSLContext(javax.net.ssl.SSLContext) Test(org.junit.jupiter.api.Test)

Example 14 with RMQConnectionFactory

use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.

the class ReceivingContextConsumerIT method init.

@BeforeEach
public void init() throws Exception {
    RMQConnectionFactory connectionFactory = (RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory().getConnectionFactory();
    connectionFactory.setReceivingContextConsumer(ctx -> receivedCount.incrementAndGet());
    connection = connectionFactory.createConnection();
    connection.start();
}
Also used : RMQConnectionFactory(com.rabbitmq.jms.admin.RMQConnectionFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 15 with RMQConnectionFactory

use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.

the class NackMessageOnRollbackIT method connection.

private QueueConnection connection() throws Exception {
    RMQConnectionFactory connectionFactory = (RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory().getConnectionFactory();
    connectionFactory.setNackOnRollback(true);
    QueueConnection queueConnection = connectionFactory.createQueueConnection();
    queueConnection.start();
    return queueConnection;
}
Also used : RMQConnectionFactory(com.rabbitmq.jms.admin.RMQConnectionFactory)

Aggregations

RMQConnectionFactory (com.rabbitmq.jms.admin.RMQConnectionFactory)16 BeforeEach (org.junit.jupiter.api.BeforeEach)4 Session (javax.jms.Session)3 SSLContext (javax.net.ssl.SSLContext)3 Test (org.junit.jupiter.api.Test)3 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)2 BlockingQueue (java.util.concurrent.BlockingQueue)2 Queue (javax.jms.Queue)2 RMQTextMessage (com.rabbitmq.jms.client.message.RMQTextMessage)1 DataConnectException (io.openmessaging.connector.api.exception.DataConnectException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 ArrayList (java.util.ArrayList)1 Connection (javax.jms.Connection)1 Destination (javax.jms.Destination)1 JMSException (javax.jms.JMSException)1 MessageProducer (javax.jms.MessageProducer)1 QueueConnection (javax.jms.QueueConnection)1 TextMessage (javax.jms.TextMessage)1