Example usage for com.rabbitmq.client ConnectionFactory DEFAULT_CONNECTION_TIMEOUT

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

Introduction

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

Prototype

int DEFAULT_CONNECTION_TIMEOUT

To view the source code for com.rabbitmq.client ConnectionFactory DEFAULT_CONNECTION_TIMEOUT.

Click Source Link

Document

The default TCP connection timeout: 60 seconds

Usage

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

License:Apache License

@Test
public void testDefaultProperties() throws Exception {
    RabbitMQEndpoint endpoint = createEndpoint(new HashMap<String, Object>());

    assertEquals(14, endpoint.getPortNumber());
    assertEquals(10, endpoint.getThreadPoolSize());
    assertEquals(true, endpoint.isAutoAck());
    assertEquals(true, endpoint.isAutoDelete());
    assertEquals(true, endpoint.isDurable());
    assertEquals("direct", endpoint.getExchangeType());
    assertEquals(ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT, endpoint.getConnectionTimeout());
    assertEquals(ConnectionFactory.DEFAULT_CHANNEL_MAX, endpoint.getRequestedChannelMax());
    assertEquals(ConnectionFactory.DEFAULT_FRAME_MAX, endpoint.getRequestedFrameMax());
    assertEquals(ConnectionFactory.DEFAULT_HEARTBEAT, endpoint.getRequestedHeartbeat());
    assertNull(endpoint.getConnectionFactory());
}

From source file:org.apache.flink.streaming.connectors.rabbitmq.common.RMQConnectionConfigTest.java

License:Apache License

@Test(expected = NullPointerException.class)
public void shouldSetDefaultValueIfConnectionTimeoutNotGiven()
        throws NoSuchAlgorithmException, KeyManagementException, URISyntaxException {
    RMQConnectionConfig connectionConfig = new RMQConnectionConfig.Builder().setHost("localhost")
            .setUserName("guest").setPassword("guest").setVirtualHost("/").build();
    ConnectionFactory factory = connectionConfig.getConnectionFactory();
    assertEquals(ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT, factory.getConnectionTimeout());
}

From source file:org.apache.flume.rabbitmq.source.RabbitMQSource.java

License:Apache License

@Override
public void configure(Context context) {
    hosts = context.getString(HOSTNAME, ConnectionFactory.DEFAULT_HOST);

    port = context.getInteger(PORT, ConnectionFactory.DEFAULT_AMQP_PORT);
    virtualHost = context.getString(VIRTUAL_HOST, ConnectionFactory.DEFAULT_VHOST);

    userName = context.getString(USERNAME, ConnectionFactory.DEFAULT_USER);

    password = context.getString(PASSWORD, ConnectionFactory.DEFAULT_PASS);

    connectionTimeout = context.getInteger(CONNECTION_TIMEOUT, ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT);
    requestedHeartbeat = context.getInteger(REQUESTED_HEARTBEAT, ConnectionFactory.DEFAULT_HEARTBEAT);
    requestedChannelMax = context.getInteger(REQUESTED_CHANNEL_MAX, ConnectionFactory.DEFAULT_CHANNEL_MAX);
    requestedFrameMax = context.getInteger(REQUESTED_FRAMEL_MAX, ConnectionFactory.DEFAULT_FRAME_MAX);

    connectionFactory = new RabbitMQConnectionFactory.Builder().addHosts(hosts).setPort(port)
            .setVirtualHost(virtualHost).setUserName(userName).setPassword(password)
            .setConnectionTimeOut(connectionTimeout).setRequestedHeartbeat(requestedHeartbeat)
            .setRequestedChannelMax(requestedChannelMax).setRequestedFrameMax(requestedFrameMax).build();

    exchangeName = context.getString(EXCHANGE_NAME, StringUtils.EMPTY);
    queueName = context.getString(QUEUE_NAME, StringUtils.EMPTY);
    Preconditions.checkArgument(StringUtils.isNotEmpty(exchangeName) || StringUtils.isNotEmpty(queueName),
            "Atleast exchange name or queue name must be defined.");

    topics = StringUtils.split(context.getString(TOPICS, StringUtils.EMPTY), ",");

    String queueParams = context.getString(QUEUE_PARAMETERS, StringUtils.EMPTY);
    queueParameters = initializeQueueParameters(queueParams);

    batchSize = context.getInteger(BATCH_SIZE, DEFAULT_BATCH_SIZE);
}

From source file:org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNodeConfiguration.java

License:Apache License

@Override
public TbRabbitMqNodeConfiguration defaultConfiguration() {
    TbRabbitMqNodeConfiguration configuration = new TbRabbitMqNodeConfiguration();
    configuration.setExchangeNamePattern("");
    configuration.setRoutingKeyPattern("");
    configuration.setMessageProperties(null);
    configuration.setHost(ConnectionFactory.DEFAULT_HOST);
    configuration.setPort(ConnectionFactory.DEFAULT_AMQP_PORT);
    configuration.setVirtualHost(ConnectionFactory.DEFAULT_VHOST);
    configuration.setUsername(ConnectionFactory.DEFAULT_USER);
    configuration.setPassword(ConnectionFactory.DEFAULT_PASS);
    configuration.setAutomaticRecoveryEnabled(false);
    configuration.setConnectionTimeout(ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT);
    configuration.setHandshakeTimeout(ConnectionFactory.DEFAULT_HANDSHAKE_TIMEOUT);
    configuration.setClientProperties(Collections.emptyMap());
    return configuration;
}