Example usage for com.rabbitmq.client ConnectionFactory setRequestedHeartbeat

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

Introduction

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

Prototype

public void setRequestedHeartbeat(int requestedHeartbeat) 

Source Link

Document

Set the requested heartbeat timeout.

Usage

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);/*www . j  av  a2  s.co  m*/
    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;
}