当前位置: 首页 > 知识库问答 >
问题:

ActiveMQ Artemis STOMP接受程序不接受

厍建义
2023-03-14

这是我的蓝图代码。
内部激活emq:队列:x消息工作。
外部踩踏:队列: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中设置时,我能够向61613上的嵌入式代理发送和接收STOMP消息。xml

现在,我正在使用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。

有什么想法吗?

编辑:添加Justin的信息:

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

额外客户端代码段:

    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>

共有2个答案

秦承安
2023-03-14

好吧,也许还有更多,但我已经摆弄这个一周了,我很确定它并没有像广告上所说的那样奏效。

我切换到使用“activemq:queue:reply”而不是“stomp:queue:reply”,这并不完美,但至少它可以处理stomp消息。

仲法
2023-03-14

将其添加到Artemisbroker.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>

这告诉代理,发送到以队列开头的目的地的STOMP消息(就像您正在使用的)应该使用anycast语义路由,而不是默认的多播语义。

 类似资料:
  • 问题内容: 我正在使用JBoss AS 7,并尝试使用IP(从Intranet中的计算机)连接到我的应用程序。它不起作用。如果我从具有服务器的计算机上进行测试,则可以通过localhost(http:// localhost:8080 / MySystem ....)看到系统正在运行,但是如果我尝试使用IP(http://: 8080 / MySystem ....)。 有什么帮助吗? 问题答案:

  • 我正在使用tomcat v8,并试图通过RequestBody向我的REST API发送一个对象。这个REST API基本上是RequestMethod。这个API内部的逻辑是删除RequestBody中传递的对象。 这对我不起作用。我后来不得不将我的方法转换为POST,但我仍然想知道DELETE是否不接受RequestBody? 这是来自Spring框架或REST原则的限制,还是与我的Tomca

  • 下面,我有我试图使用的代码。它总是命中捕捉,返回空。月和日都是整数,它们已经过检查,以确保它们在现有日期内。不管怎样,我用“05”测试一个月,用“02”测试一天。由于某种原因, ##/## 输入不起作用吗? 编辑:我正在尝试格式化此输出,使其看起来像“May 02”。当我查看文档时,我看到页面的很大一部分专门用于格式化输出。为什么我的格式不是这样?

  • $Eclipse不喜欢后面的add语句,也就是说:ArrayList(SortNames.CelebrityNamesFile)类型中的方法add(SortNames.CelebrityNamesFile)不适用于参数(String) $,然后它不喜欢我的sort语句,也就是说:Bound mismatch:类型集合的泛型方法sort(List T)不适用于参数(ArrayList(sortnam

  • 我正在将现有代码迁移到一个超类/子类的情况下。见下文。 方法在父类中:

  • 我正在尝试基于非阻塞NIO消息开发自己的通信库。我已经阅读了1000篇关于它的教程和书中的章节,我认为最后我有了一些可以在几乎没有同时连接的情况下工作的东西。但是当我在服务器端有很多连接共存时,我遇到了一些问题。 我有4个私有方法的典型选择器实现:accept、finishConnect、read和write。我的问题在于前两个:接受和完成连接。 当客户端打开一个新的套接字,并且一个可接受的键唤醒