Example usage for com.rabbitmq.client ConnectionFactory setPassword

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

Introduction

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

Prototype

public void setPassword(String password) 

Source Link

Document

Set the password.

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);//from w  w  w  .  jav  a2  s.c o  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;
}

From source file:zipkin2.autoconfigure.collector.rabbitmq.ZipkinRabbitMQCollectorProperties.java

License:Apache License

public RabbitMQCollector.Builder toBuilder()
        throws KeyManagementException, NoSuchAlgorithmException, URISyntaxException {
    final RabbitMQCollector.Builder result = RabbitMQCollector.builder();
    ConnectionFactory connectionFactory = new ConnectionFactory();
    if (concurrency != null)
        result.concurrency(concurrency);
    if (connectionTimeout != null)
        connectionFactory.setConnectionTimeout(connectionTimeout);
    if (queue != null)
        result.queue(queue);//from  w  w  w  .  ja  v a 2s . c om

    if (uri != null) {
        connectionFactory.setUri(uri);
    } else {
        if (addresses != null)
            result.addresses(addresses);
        if (password != null)
            connectionFactory.setPassword(password);
        if (username != null)
            connectionFactory.setUsername(username);
        if (virtualHost != null)
            connectionFactory.setVirtualHost(virtualHost);
        if (useSsl != null && useSsl)
            connectionFactory.useSslProtocol();
    }
    result.connectionFactory(connectionFactory);
    return result;
}