【问题标题】:ActiveMQ Artemis STOMP acceptor not acceptingActiveMQ Artemis STOMP 接受器不接受
【发布时间】:2019-05-01 19:26:38
【问题描述】:

这是我的蓝图代码。
内部 activemq:queue:x 消息有效。
外部stomp:queue:y 消息不会。

<bean id="artemisConnectionFactory"
    class="org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory">
    <argument value="${activeMq.Uri}" />
    <argument value="${activeMq.userName}" />
    <argument value="${activeMq.password}" />
</bean>

<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="artemisConnectionFactory" />
</bean>

<bean id="stomp" class="org.apache.camel.component.stomp.StompComponent">
    <property name="brokerURL" value="${activeMq.Uri}" /> 
    <property name="login" value="${activeMq.userName}" />
    <property name="passcode" value="${activeMq.password}" />
</bean>

我在 docker 中运行 Red Hat AMQ 7 和 Fuse 7。内部消息队列在服务之间工作正常。

使用 AMQ 6,当在 activemq.xml 中设置时,我能够向 61613 上的嵌入式代理发送和接收 STOMP 消息

现在我使用 AMQ 7.0 的默认设置,它为 0.0.0.0:61616 和 61613 设置了接受器,它们都接受 STOMP 协议。

但是相同的客户端代码不再到达 AMQ 7。我正在使用 Docker 公开和映射的端口。

我将此代码用于客户端。 https://github.com/apache/activemq/tree/master/assembly/src/release/examples/stomp/java

同样,我可以作为消费者连接到 AMQ 6,但不再连接到 AMQ 7。

有什么想法吗?

编辑:为贾斯汀添加信息:

19:10:41.325 INFO [Blueprint Event Dispatcher: 1] Attempting to start CamelContext: ProxyService
19:10:41.326 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.21.0.fuse-000077-redhat-1 (CamelContext: ProxyService) is starting
19:10:41.326 INFO [Blueprint Event Dispatcher: 1] JMX is enabled
19:10:41.415 INFO [Blueprint Event Dispatcher: 1] StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
19:10:41.682 INFO [Blueprint Event Dispatcher: 1] Route: proxyqueue started and consuming from: activemq://queue:registration?password=xxxxxx&username=admin
19:10:41.683 INFO [Blueprint Event Dispatcher: 1] Route: proxyreplyqueue started and consuming from: stomp://queue:reply?login=admin&passcode=xxxxxx
19:10:41.683 INFO [Blueprint Event Dispatcher: 1] Total 2 routes, of which 2 are started
19:10:41.683 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.21.0.fuse-000077-redhat-1 (CamelContext: ProxyService) started in 0.358 seconds

阿尔忒弥斯原木

2018-11-28 17:38:24,066 INFO  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
2018-11-28 17:38:24,286 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
2018-11-28 17:38:24,504 INFO  [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal
2018-11-28 17:38:24,628 INFO  [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1,073,741,824
2018-11-28 17:38:24,687 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2018-11-28 17:38:24,699 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2018-11-28 17:38:24,700 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2018-11-28 17:38:24,700 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2018-11-28 17:38:24,700 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2018-11-28 17:38:24,701 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2018-11-28 17:38:24,952 INFO  [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock
2018-11-28 17:38:24,952 INFO  [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock
2018-11-28 17:38:25,335 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying queue DLQ on address DLQ
2018-11-28 17:38:25,511 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying queue ExpiryQueue on address ExpiryQueue
2018-11-28 17:38:26,119 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
2018-11-28 17:38:26,171 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols [HORNETQ,STOMP]
2018-11-28 17:38:26,231 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2018-11-28 17:38:26,243 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2018-11-28 17:38:26,250 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2018-11-28 17:38:26,255 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2018-11-28 17:38:26,255 INFO  [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.6.1.amq-720004-redhat-1 [0.0.0.0, nodeID=a46b729a-f323-11e8-9efc-0242ac120003]
2018-11-28 17:38:26,861 INFO  [io.hawt.branding.plugin.PluginContextListener] Initialized hawtio-redhat-fuse-branding plugin
2018-11-28 17:38:26,978 INFO  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2018-11-28 17:38:27,066 INFO  [org.apache.qpid.dispatch.PluginContextListener] Initialized dispatch-hawtio-console plugin
2018-11-28 17:38:27,915 INFO  [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2018-11-28 17:38:27,918 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to hawtio 1.4.0.redhat-630329 : http://hawt.io/ : Don't cha wish your console was hawt like me? ;-)
2018-11-28 17:38:27,925 INFO  [io.hawt.jmx.UploadManager] Using file upload directory: /opt/amq/broker/tmp/uploads
2018-11-28 17:38:27,980 INFO  [io.hawt.web.AuthenticationFilter] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "amq" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2018-11-28 17:38:28,068 INFO  [io.hawt.web.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/opt/amq/broker/etc/jolokia-access.xml]
2018-11-28 17:38:28,093 INFO  [io.hawt.web.RBACMBeanInvoker] Using MBean [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role based access control
2018-11-28 17:38:28,289 INFO  [io.hawt.system.ProxyWhitelist] Initial proxy whitelist: [localhost, 127.0.0.1, 172.18.0.3, 9f81c3ea25d9]
2018-11-28 17:38:28,989 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://localhost:8161
2018-11-28 17:38:28,989 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
2018-11-28 17:38:28,989 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://localhost:8161/console
2018-11-28 17:45:54,038 WARN  [org.apache.activemq.artemis.core.server] AMQ222067: Connection failure has been detected: AMQ119014: Did not receive data from /127.0.0.1:51052 within the 60,000ms connection TTL. The connection will now be closed. [code=CONNECTION_TIMEDOUT]
2018-11-28 17:45:54,039 WARN  [org.apache.activemq.artemis.core.server] AMQ222061: Client connection failed, clearing up resources for session 8bc75a6c-f324-11e8-9efc-0242ac120003
2018-11-28 17:45:54,039 WARN  [org.apache.activemq.artemis.core.server] AMQ222107: Cleared up resources for session 8bc75a6c-f324-11e8-9efc-0242ac120003

额外的客户端代码sn-p:

    String user = env("ACTIVEMQ_USER", "admin");
    String password = env("ACTIVEMQ_PASSWORD", "password");
    String host = env("ACTIVEMQ_HOST", "10.20.40.20");
    int port = Integer.parseInt(env("ACTIVEMQ_PORT", "19999"));
    String destination = arg(args, 0, "/queue/reply");

外部骆驼路线:

<camel:route id="proxyreplyqueue">  
    <camel:from uri="stomp:queue:reply?login=admin&amp;passcode=password"/>  
    <camel:to uri="log:input?showAll=true&amp;level=INFO"/>
    <camel:to uri="bean:replyHandlerService"/>
</camel:route>

内部骆驼路线:

<camel:route id="profproxyqueue">  
    <camel:from uri="activemq:queue:registration?username=admin&amp;password=xxxxx"/>
    <camel:to uri="stomp:queue:stompregister"/>
</camel:route>

【问题讨论】:

  • 您是否收到来自客户端的错误?如果是这样,它是什么?他们对经纪人有任何错误吗?您的 AMQ 6 实例也使用 0.0.0.0 吗?您能否提供来自代理的启动日志,其中包含有关接受者的信息?
  • 我的 AMQ 6 也是 0.0.0.0,AMQ 7 默认接受器为 0.0.0.0。使用 Publisher 客户端,没有错误。 stomp://queue:reply 没有任何内容。使用 Listener 客户端,它会等待 60 秒,并在 60 秒后获得 TTL 连接失败。我现在将粘贴启动日志...
  • 所以,奇怪的是,如果我发送到 Docker 映射的 STOMP AMQ 端口,消息会发送,但似乎没有到达。但是,如果我将端口更改为随机端口,则会显示连接被拒绝。
  • 我相信消息实际上是由客户端发送并由代理接收的,但它们没有按预期路由。您知道正在发送的 STOMP 消息的 destination 标头中使用的确切字符串吗?另外,当您使用github.com/apache/activemq/tree/master/assembly/src/release/… 的客户端时,您正在执行哪些确切的命令以及以什么顺序执行?
  • 是的,我看到如果我不关闭客户端连接,远程 AMQ 日志显示一个新错误“检测到连接失败:syscall:read(..) failed: Connection reset by peer [code=GENERIC_EXCEPTION]”,所以它至少是连接的。我已经粘贴了我的客户端配置,否则它是相同的“发布者”代码。它适用于连接到 AMQ 6 的 stomp:queue:reply 但不能连接到 AMQ 7。

标签: amqp stomp jbossfuse activemq-artemis amq


【解决方案1】:

将此添加到 Artemis broker.xml 文件中的 STOMP 接受器:

anycastPrefix=/queue/;multicastPrefix=/topic/

例如:

<acceptor name="stomp">tcp://host:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true;anycastPrefix=/queue/;multicastPrefix=/topic/</acceptor>

这告诉代理发送到以/queue/ 开头的目的地(就像您正在使用的那样)的 STOMP 消息应该使用anycast 语义而不是默认的multicast 语义进行路由。

【讨论】:

  • 所以,一些有趣的结果。我在上面的问题中添加了两条骆驼路线。外部 STOMP 消息不走运。我已经确认在我的路由启动之前 broker.xml 有您的更改,但它仍然没有显示日志中的任何传入内容。但是,内部路由可能在启动后工作了 1 分钟。我看到一条消息通过了。之后,它再次以 AMQ119014 错误开始。
  • 你能在 GitHub 上创建一个非常简单的项目,或者我可以用来重现你所看到的东西吗? Artemis 附带的示例可以提供一个很好的起点,因为它们可以自动配置代理、启动代理和运行客户端。
  • 这是一个 docker 中的 Fuse7 & AMQ7,所以很难简化。但是我打开了 Artemis 日志,发现 stomp 队列没有“ClusterCommunication addBinding”。将不得不进行更多调查,但也许这是一个骆驼和阿尔忒弥斯互操作问题,以前工作的骆驼和阿波罗配置不再适用于 stomp。
【解决方案2】:

好吧,也许还有更多,但我已经摆弄了一个星期,我很确定它不会像宣传的那样工作。

我改用“activemq:queue:reply”而不是“stomp:queue:reply”,它并不完美 - 但它至少可以处理 STOMP 消息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-15
    • 1970-01-01
    • 1970-01-01
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-21
    相关资源
    最近更新 更多