0
votes

I'm using Micronaut's RabbitMQ package to connect to my RabbitMQ server (see here: https://micronaut-projects.github.io/micronaut-rabbitmq/latest). I can easily configure the server to listen on the SSL port, however I cannot understand how can I configure my client to connect via SSL.

All examples I found create the connection manually, but in my case the connection is created behind the hood by Micronaut and I want to configure it by setting only properties.

In this section of the configuration all the rabbitmq properties are listed, however the only thing related to ssl is ssl-context-factory and no explanation or example is provided. I would have expected something like this answer for Spring where (supposedly) there exist a spring.rabbitmq.ssl.enabled property which switches SSL connections on.

  • Is there anything similar for micronaut?
  • If not, is that ssl-context-factory the correct configuration property? And how do you set it up?
  • Bonus points: how should I configure the keystore to validate the server certificate? Micronaut will automatically use the micronaut.ssl.key-store.* values for the rabbit connection?

Final note: I'm not interested in doing mTLS/client authentication by the server. I simply want my client to use an encrypted SSL connection to speak to the server. So the client should not need any certificate, it only has to validate the server certificate.

1

1 Answers

0
votes

I believe I found an answer, even though I'm not sure whether it's the best one.

Micronaut RabbitMQ support allows to specify the uri for the connection instead of the host & port. So it's possible to specify amqps://<host>:5671 and it should connect via SSL. Seems unfortunate that if you are using SSL you cannot use the host & port property though.