Java使Amazon MQ Connection超时

时间:2018-10-01 11:17:31

标签: activemq amazon

我已经在AWS中创建了一个亚马逊MQ代理,当通过开放式有线协议与其建立连接时,它变得超时了。 我用我的公共IP添加了安全组的入站规则。 代理处于活动/备用状态,并且状态为“正在运行”。

以下网址中的示例: https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-working-java-example.html#quick-start-prerequisites

通过两种方式尝试了该网址:

    ActiveMQConnectionFactory connFactory = new ActiveMQConnectionFactory("ssl://b-bfd44b26-3472-45b5-953c-880fa7259d35-1.mq.eu-west-1.amazonaws.com:61617");

Exception in thread "main" javax.jms.JMSException: Could not connect to broker URL: ssl://b-bfd44b26-3472-45b5-953c-880fa7259d35-1.mq.eu-west-1.amazonaws.com:61617. Reason: java.net.ConnectException: Connection timed out: connect

private final static String WIRE_LEVEL_ENDPOINT 
            = "failover:(ssl://b-bfd44b26-3472-45b5-953c-880fa7259d35-1.mq.eu-west-1.amazonaws.com:61617,ssl://b-bfd44b26-3472-45b5-953c-880fa7259d35-2.mq.eu-west-1.amazonaws.com:61617)?randomize=true";
final ActiveMQConnectionFactory connectionFactory =
                new ActiveMQConnectionFactory(WIRE_LEVEL_ENDPOINT);

没有例外,但这就像什么也不做。

发生异常的原因是什么?请帮助

1 个答案:

答案 0 :(得分:0)

确保在附加到Amazon MQ的SG(安全组)中为https和InBound中的“自定义TCP”启用openwire连接启用了端口8162和61617。选择“我的IP”获取您的IP。

https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-working-java-example.html#quick-start-prerequisites