Example usage for com.rabbitmq.client ConnectionFactory setUsername

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

Introduction

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

Prototype

public void setUsername(String username) 

Source Link

Document

Set the user name.

Usage

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  ww  w.j a va 2  s.  c  o m

    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;
}