Example usage for com.rabbitmq.client ConnectionFactory useSslProtocol

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

Introduction

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

Prototype

public void useSslProtocol() throws NoSuchAlgorithmException, KeyManagementException 

Source Link

Document

Convenience method for configuring TLS using the default set of TLS protocols and a trusting TrustManager.

Usage

From source file:uk.ac.soton.itinnovation.experimedia.arch.ecc.amqpAPI.impl.amqp.AMQPConnectionFactory.java

public void connectToAMQPSSLHost() throws Exception {
    // Safety first
    if (amqpHostIP == null)
        throw new Exception("AMQP Host IP not correct");
    if (amqpConnection != null)
        throw new Exception("Already connected to host");

    ConnectionFactory amqpFactory = new ConnectionFactory();
    amqpFactory.setHost(amqpHostIP.getHostAddress());
    amqpFactory.setPort(amqpPortNumber);
    amqpFactory.useSslProtocol();

    try {/*from w w  w .  jav a 2s .c  om*/
        amqpConnection = amqpFactory.newConnection();
    } catch (Exception ex) {
        throw new Exception("Could not create AMQP host SSL connection: ", ex);
    }
}

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);/*www  . ja v a  2  s  .  co 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;
}