Example usage for com.rabbitmq.client ConnectionFactory getRequestedHeartbeat

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

Introduction

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

Prototype

public int getRequestedHeartbeat() 

Source Link

Document

Retrieve the requested heartbeat interval.

Usage

From source file:mx.bigdata.utils.amqp.HaConsumer.java

License:Apache License

public HaConsumer(String tag, String key, AMQPClientHelper amqp, ConnectionFactory factory) {
    super(tag, key, amqp, factory);
    if (factory.getRequestedHeartbeat() == 0) {
        factory.setRequestedHeartbeat(DEFAULT_HEARTBEAT_SECONDS);
    }/* w ww.  ja  v a  2 s . c om*/
}

From source file:mx.bigdata.utils.amqp.HaPublisher.java

License:Apache License

public HaPublisher(String tag, String key, AMQPClientHelper amqp, ConnectionFactory factory) throws Exception {
    super(tag, key, amqp, factory);
    if (factory.getRequestedHeartbeat() == 0) {
        factory.setRequestedHeartbeat(DEFAULT_HEARTBEAT_SECONDS);
    }/*from w w  w. j a va 2  s.  c o  m*/
    initConfirms();
}

From source file:org.apache.flume.amqp.AmqpSourceTest.java

License:Apache License

@Test
public void testCreateConnectionFactoryFrom() throws Exception {
    Context ctx = createContext();

    ConnectionFactory connectionFactory = AmqpSource.createConnectionFactoryFrom(ctx);

    assertThat(connectionFactory.getHost(), is(HOST_NAME));
    assertThat(connectionFactory.getPort(), is(PORT));
    assertThat(connectionFactory.getVirtualHost(), is(VIRTUAL_HOST));
    assertThat(connectionFactory.getUsername(), is(USER_NAME));
    assertThat(connectionFactory.getPassword(), is(PASSWORD));
    assertThat(connectionFactory.getConnectionTimeout(), is(CONNECTION_TIMEOUT));
    assertThat(connectionFactory.getRequestedHeartbeat(), is(REQUEST_HEARTBEAT));
}

From source file:zebrogamq.gamelogic.ChannelsManager.java

License:Open Source License

private ConnectionFactory getConnectionFactory(final GameLogicState state) {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost(Util.getRabbitMQProperties().getProperty("gameLogicBrokerHost"));
    factory.setUsername(state.login);//from ww w. java  2  s.c  om
    factory.setPassword(state.password);
    factory.setVirtualHost(state.virtualHost);
    factory.setPort(Integer.valueOf(Util.getRabbitMQProperties().getProperty("gameLogicBrokerPort",
            String.valueOf(factory.getPort()))));
    factory.setConnectionTimeout(CONNECTION_ESTABLISHMENT_TIMEOUT);
    // set the heartbeat value for the amqp connections
    // to avoid the keeping of obsolete consumers
    factory.setRequestedHeartbeat(Integer.valueOf(Util.getRabbitMQProperties()
            .getProperty("amqpConnectionHeartbeat", String.valueOf(factory.getRequestedHeartbeat()))));
    return factory;
}