Example usage for com.rabbitmq.client ConnectionFactory setAutomaticRecoveryEnabled

List of usage examples for com.rabbitmq.client ConnectionFactory setAutomaticRecoveryEnabled

Introduction

In this page you can find the example usage for com.rabbitmq.client ConnectionFactory setAutomaticRecoveryEnabled.

Prototype

public void setAutomaticRecoveryEnabled(boolean automaticRecovery) 

Source Link

Document

Enables or disables <a href="https://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>.

Usage

From source file:com.navercorp.pinpoint.plugin.jdk7.rabbitmq.RabbitMQClient_3_3_0_to_4_0_0_IT.java

License:Apache License

@Test
public void testPush_autorecovery() throws Exception {
    ConnectionFactory connectionFactory = getConnectionFactory();
    connectionFactory.setAutomaticRecoveryEnabled(true);

    testRunner.runPushTest();/*from w ww  .  ja v a2 s  .c o  m*/
}

From source file:com.navercorp.pinpoint.plugin.jdk7.rabbitmq.RabbitMQClient_3_3_0_to_4_0_0_IT.java

License:Apache License

@Test
public void testPull() throws Exception {
    ConnectionFactory connectionFactory = getConnectionFactory();
    connectionFactory.setAutomaticRecoveryEnabled(false);

    testRunner.runPullTest();/*  w w  w . j ava 2  s.  co  m*/
}

From source file:com.navercorp.pinpoint.plugin.jdk7.rabbitmq.RabbitMQClient_3_3_0_to_4_0_0_IT.java

License:Apache License

@Test
public void testPull_autorecovery() throws Exception {
    ConnectionFactory connectionFactory = getConnectionFactory();
    connectionFactory.setAutomaticRecoveryEnabled(true);

    testRunner.runPullTest();/*from   ww w  .j  a v  a 2 s .c o m*/
}

From source file:com.navercorp.pinpoint.plugin.jdk7.rabbitmq.RabbitMQClient_5_x_IT.java

License:Apache License

@Test
public void testPush_nio() throws Exception {
    ConnectionFactory connectionFactory = getConnectionFactory();
    connectionFactory.setAutomaticRecoveryEnabled(false);
    connectionFactory.useNio();// w  w  w. j a  va  2 s . c  om

    testRunner.runPushTest();
}

From source file:com.navercorp.pinpoint.plugin.jdk7.rabbitmq.RabbitMQClient_5_x_IT.java

License:Apache License

@Test
public void testPush_nio_autorecovery() throws Exception {
    ConnectionFactory connectionFactory = getConnectionFactory();
    connectionFactory.setAutomaticRecoveryEnabled(true);
    connectionFactory.useNio();/*from  w ww .ja  va  2 s . c  o m*/

    testRunner.runPushTest();
}

From source file:com.navercorp.pinpoint.plugin.jdk7.rabbitmq.RabbitMQClient_5_x_IT.java

License:Apache License

@Test
public void testPull_nio() throws Exception {
    ConnectionFactory connectionFactory = getConnectionFactory();
    connectionFactory.setAutomaticRecoveryEnabled(false);
    connectionFactory.useNio();//from   ww  w  .  j av  a2s.c o  m

    testRunner.runPullTest();
}

From source file:com.navercorp.pinpoint.plugin.jdk7.rabbitmq.RabbitMQClient_5_x_IT.java

License:Apache License

@Test
public void testPull_nio_autorecovery() throws Exception {
    ConnectionFactory connectionFactory = getConnectionFactory();
    connectionFactory.setAutomaticRecoveryEnabled(true);
    connectionFactory.useNio();/*from w  w  w .  j ava 2s. com*/

    testRunner.runPullTest();
}

From source file:com.novemberain.langohr.Connection.java

License:Open Source License

public Connection(ConnectionFactory cf, IPersistentMap options) {
    this.cf = cf;
    this.options = options;

    Long l = (Long) options.valAt(NETWORK_RECOVERY_DELAY_KEYWORD, DEFAULT_NETWORK_RECOVERY_DELAY);
    cf.setNetworkRecoveryInterval(l.intValue());

    this.automaticallyRecover = Util.isTruthy(options.valAt(AUTOMATICALLY_RECOVER_KEYWORD, true));
    this.automaticallyRecoverTopology = Util
            .isTruthy(options.valAt(AUTOMATICALLY_RECOVER_TOPOLOGY_KEYWORD, true));

    cf.setAutomaticRecoveryEnabled(this.automaticallyRecover);
    cf.setTopologyRecoveryEnabled(this.automaticallyRecoverTopology);
}

From source file:com.nxttxn.vramel.components.rabbitMQ.RabbitMQEndpoint.java

License:Apache License

private ConnectionFactory getOrCreateConnectionFactory() {
    if (connectionFactory == null) {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUsername(getUsername());
        factory.setPassword(getPassword());
        factory.setVirtualHost(getVhost());
        factory.setHost(getHostname());//w  ww .j a  v  a2 s .c  o m
        factory.setPort(getPortNumber());
        if (getClientProperties() != null) {
            factory.setClientProperties(getClientProperties());
        }
        factory.setConnectionTimeout(getConnectionTimeout());
        factory.setRequestedChannelMax(getRequestedChannelMax());
        factory.setRequestedFrameMax(getRequestedFrameMax());
        factory.setRequestedHeartbeat(getRequestedHeartbeat());
        if (getSslProtocol() != null) {
            try {
                if (getSslProtocol().equals("true")) {
                    factory.useSslProtocol();
                } else if (getTrustManager() == null) {
                    factory.useSslProtocol(getSslProtocol());
                } else {
                    factory.useSslProtocol(getSslProtocol(), getTrustManager());
                }
            } catch (NoSuchAlgorithmException | KeyManagementException e) {
                throw new IllegalArgumentException("Invalid sslProtocol " + sslProtocol, e);
            }
        }
        if (getAutomaticRecoveryEnabled() != null) {
            factory.setAutomaticRecoveryEnabled(getAutomaticRecoveryEnabled());
        }
        if (getNetworkRecoveryInterval() != null) {
            factory.setNetworkRecoveryInterval(getNetworkRecoveryInterval());
        }
        if (getTopologyRecoveryEnabled() != null) {
            factory.setTopologyRecoveryEnabled(getTopologyRecoveryEnabled());
        }
        connectionFactory = factory;
    }
    return connectionFactory;
}

From source file:com.paxxis.cornerstone.messaging.service.amqp.AMQPServiceBusConnector.java

License:Apache License

protected void initConnection() {
    try {//from ww  w  .j a  v  a 2 s  .  co  m
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost(host);
        factory.setPort(port);
        factory.setAutomaticRecoveryEnabled(autoRecover);
        factory.setConnectionTimeout(timeout);
        factory.setNetworkRecoveryInterval(recoveryInterval);
        factory.setRequestedHeartbeat(heartbeat);
        factory.setTopologyRecoveryEnabled(autoTopologyRecover);
        factory.setExceptionHandler(exceptionHandler);

        connection = factory.newConnection();
        session = (AMQPSession) createSession();
    } catch (IOException e) {
        logger.error(e);
        throw new RuntimeException(e);
    }
}