使用Core API连接到ActiveMQ Artemis Docker容器
我正在尝试使用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();
运行时,当我尝试创build会话工厂时,出现以下错误。
ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]
在尝试连接到ActiveMQ Artemis代理时,似乎是缺less一个关键的configuration步骤。 有一个XML文件,我需要放置在我的Java客户端应用程序的某个地方,或者我可以在代码中设置适当的设置?
AtiveMQ Artemis的Docker镜像我正在使用:
https://github.com/vromero/activemq-artemis-docker
也许你忘了公开的端口通过-p 61616:61616
- 在Windows上运行docker镜像的结果是“oci runtime error:exec:”bash“:可执行文件在$ PATH中找不到。
- 版本标记的docker baseimages有多稳定? 我应该制作自己的副本吗?