分布式消息服务RABBITMQ版-SSL方式连接RabbitMQ实例失败?

时间:2024-06-19 16:03:05

SSL方式连接RabbitMQ实例失败?

首先排查安全组的入方向规则,是否放开了端口5671(SSL方式访问)或5672(非SSL访问)。

其次,参考如下内容配置SSL单向认证:

1
2
3
4
5
6
7
8
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost(host);
        factory.setPort(port);
        factory.setUsername(user);
        factory.setPassword(password);
        factory.useSslProtocol();
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
support.huaweicloud.com/rabbitmq_faq/rabbitmq-faq-200518016.html