'AWS AMQP + SSL Connection with vertx

I am trying to connect a service with activemQ in my local i am trying with this connection:

fun start(vertx: Vertx, address: String): Single<MQServerConnection> {
    val options: AmqpClientOptions = AmqpClientOptions()
        .setHost("localhost")
        .setPort(5672)
    logger.info("ACTIVE_MQ_PROVIDER_STARTING_IN_THREAD_[" + Thread.currentThread().name + "]")

    return AmqpClient.create(vertx, options).rxConnect().flatMap { amqpConnection ->
        amqpConnection.rxCreateAnonymousSender().flatMap { responseSender ->
            amqpConnection.rxCreateReceiver(address).map { receiver ->
                MQServerConnection(amqpConnection, responseSender, receiver)
            }
        }
    }
}

where

data class MQServerConnection(
    val amqpConnection: AmqpConnection,
    val amqpSender: AmqpSender,
    val amqpReceiver: AmqpReceiver
)

And it works fine.

Now i am trying to use the AWS service, but it returns to me:

failover:(amqp+ssl://b-4eb4c78c-048b-436c-941e-31250830323e-1.mq.us-east-1.amazonaws.com:5671,amqp+ssl://b-4eb4c78c-048b-436c-941e-31250830323e-2.mq.us-east-1.amazonaws.com:5671)

I don't know how to send the HOST instead of localhost

and insted of port.

Regards



Solution 1:[1]

The ssl property of AmqpClientOptions has to be true for AMQPS, i.e.

val options: AmqpClientOptions = AmqpClientOptions()
    .setHost("b-4eb4c78c-048b-436c-941e-31250830323e-1.mq.us-east-1.amazonaws.com")
    .setPort(5671)
    .setSsl(true)
    .setUsername("admin")
    .setPassword("admin")
    //This is required only if the AWS service uses a self-signed certificate
    .setTrustAll(true)
    //This is required only if the AWS service uses a certificate with a CN that doesn't match the hostname
    .setHostnameVerificationAlgorithm("")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Domenico Francesco Bruscino