【问题标题】:Connecting to ActiveMQ Artemis Docker Container with Core API使用 Core API 连接到 ActiveMQ Artemis Docker 容器
【发布时间】:2017-01-17 15:05:47
【问题描述】:

我正在尝试使用 ActiveMQ Artemis Core API 连接到在 docker 容器中运行的 ActiveMQ Artemis。

我正在使用以下代码尝试连接。

Map<String,Object> connectionParams = new HashMap<String, Object>();
connectionParams.put(TransportConstants.PORT_PROP_NAME, "61616");
connectionParams.put(TransportConstants.HOST_PROP_NAME, "localhost");


TransportConfiguration tc = new TransportConfiguration(NettyConnectorFactory.class.getName(),connectionParams);

ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(tc);

ClientSessionFactory queueFactory = locator.createSessionFactory();

在运行时,当我尝试创建会话工厂时出现以下错误。

ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]

在尝试连接到 ActiveMQ Artemis 代理时,我似乎错过了一个关键的配置步骤。是否需要将 XML 文件放在我的 Java 客户端应用程序的某个位置,或者我可以在代码中设置正确的设置吗?

我正在使用的 AtiveMQ Artemis 的 Docker 映像:

https://github.com/vromero/activemq-artemis-docker

【问题讨论】:

    标签: java docker activemq activemq-artemis


    【解决方案1】:

    也许你忘了通过-p 61616:61616公开端口

    【讨论】:

    • 是的……就是这样。使用 Docker IP 对其进行了测试并且可以正常工作,然后确保发布端口并且它也可以与 localhost 一起使用。
    猜你喜欢
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 2021-05-16
    • 1970-01-01
    • 2020-03-31
    • 1970-01-01
    • 1970-01-01
    • 2021-05-26
    相关资源
    最近更新 更多