Skip to content

Customizing the underlying RabbitMQ client

You can customize the underlying RabbitMQ Client configuration by producing an instance of RabbitMQOptions:

@Produces
@Identifier("my-named-options")
public RabbitMQOptions getNamedOptions() {
    // You can use the produced options to configure the TLS connection
    PemKeyCertOptions keycert = new PemKeyCertOptions()
            .addCertPath("./tls/tls.crt")
            .addKeyPath("./tls/tls.key");
    PemTrustOptions trust = new PemTrustOptions().addCertPath("./tlc/ca.crt");

    return (RabbitMQOptions) new RabbitMQOptions()
            .setUser("admin")
            .setPassword("test")
            .setSsl(true)
            .setPemKeyCertOptions(keycert)
            .setPemTrustOptions(trust)
            .setHostnameVerificationAlgorithm("HTTPS")
            .setConnectTimeout(30000)
            .setReconnectInterval(5000);
}

This instance is retrieved and used to configure the client used by the connector. You need to indicate the name of the client using the client-options-name attribute:

1
mp.messaging.incoming.prices.client-options-name=my-named-options