0
votes

This is my blueprint code.
Internal activemq:queue:x messages work.
External stomp:queue:y messages don't.

<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>

I am running Red Hat AMQ 7 and Fuse 7 inside a docker. The internal message queues work fine between services.

With AMQ 6 I was able to send and receive STOMP messages to an embedded broker on 61613 when set up in the activemq.xml

Now I am using the default setup for AMQ 7.0, which has acceptors set up for 0.0.0.0:61616 and 61613, both accepting STOMP protocol.

But the same client code no longer reaches AMQ 7. I'm using the ports exposed and mapped by Docker.

I use this code for the client. https://github.com/apache/activemq/tree/master/assembly/src/release/examples/stomp/java

Likewise, I could connect as a consumer with AMQ 6 but no longer with AMQ 7.

Any idea?

Edit: Adding info for 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

Artemis logs

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

Extra client code snippet:

    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");

External camel route:

<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>

Internal 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
Are you getting an error from the client? If so, what is it? Are they any errors on the broker? Was your AMQ 6 instance using 0.0.0.0 also? Can you provide the startup logging from the broker which contain the information about the acceptors?Justin Bertram
My AMQ 6 was also 0.0.0.0, and AMQ 7 defaults acceptors to 0.0.0.0. With the Publisher client, there's no error. Nothing arrives at stomp://queue:reply. With the Listener client, it waits for 60 seconds and gets a TTL connection failure after 60 seconds. I'll paste the startup logs now...djb
So, the odd thing is that if I send to the Docker-mapped STOMP AMQ ports, the messages send, though do not seem to arrive. But if I change the port to a random one, it shows Connection refused.djb
I believe that the messages are actually being sent by the client(s) and received by the broker but that they aren't being routed as expected. Do you know the exact string used in the destination header of the STOMP messages which are being sent? Also, when you use the clients at github.com/apache/activemq/tree/master/assembly/src/release/… what exact commands are you executing and in what order?Justin Bertram
Yeah, I see that if I don't close the client connection, the remote AMQ logs show a new error " Connection failure has been detected: syscall:read(..) failed: Connection reset by peer [code=GENERIC_EXCEPTION]", so it is connecting at least. I've pasted my client config, otherwise it's the same 'Publisher' code. It works for connecting to AMQ 6's stomp:queue:reply but not to AMQ 7's.djb

2 Answers

0
votes

Add this to your STOMP acceptor(s) in the Artemis broker.xml file:

anycastPrefix=/queue/;multicastPrefix=/topic/

For example:

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

This tell the broker that STOMP messages sent to destinations beginning with /queue/ (like you are using) should be routed using anycast semantics rather than the default multicast semantics.

-1
votes

Ok well maybe there's more to it, but I've been fiddling with this for a week, and am pretty sure it just doesn't work as advertised.

I switched to using "activemq:queue:reply" instead of "stomp:queue:reply", and it's not perfect - but it handles STOMP messages, at least.