Show
Reproducer attached. The camel-springboot-activemq-consumer-1.0-SNAPSHOT.jar.gz is an executable jar that should run without external dependencies, other than 1.8 JVM version (tested on a host other than the build host). It will try to connect to a localhost broker on 61616.
Directions:
Extract the amq-broker-7.4.0-bin / amq-broker-7.4.1.CR2-bin distribution to a local directory.
Create a broker with:
[user@node1 bin]$ ./artemis create /home/user/amq/containers/741CR1
Creating ActiveMQ Artemis instance at: /home/user/amq/containers/741CR1
--user: is a mandatory property!
Please provide the default username:
admin
--password: is mandatory with this configuration:
Please provide the default password:
[admin]
--allow-anonymous | --require-login: is a mandatory property!
Allow anonymous access?, valid values are Y,N,True,False
N
Auto tuning journal ...
done! Your system can make 2.98 writes per millisecond, your journal-buffer-timeout will be 336000
You can now start the broker by executing:
"/home/user/amq/containers/741CR1/bin/artemis" run
...
Replace the /home/user/amq/containers/741CR1/etc/broker.xml with the example attached, with configured TEST1 and TEST1.FORWARDED addresses and associated divert
Edit jolokia-access.xml / bootstrap.xml as needed if accessing console remotely
Extract the camel-springboot-activemq-consumer-1.0-SNAPSHOT.jar.gz archive to the same host as the broker
Start the broker with /path/to/broker/bin/artemis run
Start the camel application with java -jar camel-springboot-activemq-consumer-1.0-SNAPSHOT.jar and watch for the line that says "connected to remote Broker: amqp://localhost:61616"
Open the broker console and find the "TEST.QUEUE.0" address (should be created by the camel application) - the underlying queue should have an attached consumer.
Click on the "send" tab to open the send message dialog, select "Plain text" as the message type and enter some text in the text dialog box, then click "Send message"
You should see the app pick up the message and drop it into the TEST1 queue and the routed count increment and see the message count increment in the TEST1.FORWARDED queue
Now open a separate terminal in the broker bin directory and attempt to browse the TEST1.FORWARDED queue
./artemis browser --user admin --password admin --destination TEST1.FORWARDED --verbose
In the client we see:
Executing org.apache.activemq.artemis.cli.commands.messages.Browse browser --user admin --password admin --destination TEST1.FORWARDED --verbose
Home::/home/user/amq/amq-broker-7.4.1, Instance::/home/user/amq/containers/741CR1
Consumer:: filter = null
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 trying to browse 1000 messages
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 browsed: 0 messages
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 Browser thread finished
In the broker log (depending on version), we see:
2019-08-24 11:26:10,775 ERROR [org.apache.activemq.artemis.core.server] AMQ224046: Exception while browser handled from Reference[36]:RELIABLE:AMQPMessage [durable= true , messageID=36, address=TEST1.FORWARDED, size=364, applicationProperties=ApplicationProperties{{breadcrumbId=queue_TEST.QUEUE.0_null, CamelJmsDeliveryMode=2}}, properties=Properties{messageId=ID:88503c13-148d-434b-a2e0-9292a24af2ba:1:1:1-1, userId= null , to= 'TEST1.FORWARDED' , subject= ' null ' , replyTo= ' null ' , correlationId= null , contentType= null , contentEncoding= null , absoluteExpiryTime= null , creationTime=Sat Aug 24 11:01:37 EDT 2019, groupId= ' null ' , groupSequence= null , replyToGroupId= ' null ' }, extraProperties = TypedProperties[_AMQ_AD=TEST1.FORWARDED]]: java.lang.RuntimeException
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.toCore(AMQPMessage.java:706) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.protocol.core.impl.CoreSessionCallback.sendMessage(CoreSessionCallback.java:123) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.deliverStandardMessage(ServerConsumerImpl.java:1145) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.proceedDeliver(ServerConsumerImpl.java:504) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl$BrowserDeliverer.run(ServerConsumerImpl.java:1461) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:66) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_222]
at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
Caused by: java.lang.NullPointerException
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.scanForMessageSection(AMQPMessage.java:357) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.getBody(AMQPMessage.java:319) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.toCore(AMQPMessage.java:703) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
... 10 more
2019-08-24 11:26:10,780 WARN [org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage] null : java.lang.NullPointerException
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.scanForMessageSection(AMQPMessage.java:357) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.getBody(AMQPMessage.java:319) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.toCore(AMQPMessage.java:703) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.protocol.core.impl.CoreSessionCallback.sendMessage(CoreSessionCallback.java:123) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.deliverStandardMessage(ServerConsumerImpl.java:1145) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.proceedDeliver(ServerConsumerImpl.java:504) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl$BrowserDeliverer.run(ServerConsumerImpl.java:1461) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:66) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_222]
at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
2019-08-24 11:26:10,780 ERROR [org.apache.activemq.artemis.core.server] AMQ224046: Exception while browser handled from Reference[45]:RELIABLE:AMQPMessage [durable= true , messageID=45, address=TEST1.FORWARDED, size=358, applicationProperties=ApplicationProperties{{breadcrumbId=queue_TEST.QUEUE.0_null, CamelJmsDeliveryMode=2}}, properties=Properties{messageId=ID:88503c13-148d-434b-a2e0-9292a24af2ba:1:1:2-1, userId= null , to= 'TEST1.FORWARDED' , subject= ' null ' , replyTo= ' null ' , correlationId= null , contentType= null , contentEncoding= null , absoluteExpiryTime= null , creationTime=Sat Aug 24 11:18:53 EDT 2019, groupId= ' null ' , groupSequence= null , replyToGroupId= ' null ' }, extraProperties = TypedProperties[_AMQ_AD=TEST1.FORWARDED]]: java.lang.RuntimeException
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.toCore(AMQPMessage.java:706) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.protocol.core.impl.CoreSessionCallback.sendMessage(CoreSessionCallback.java:123) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.deliverStandardMessage(ServerConsumerImpl.java:1145) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.proceedDeliver(ServerConsumerImpl.java:504) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl$BrowserDeliverer.run(ServerConsumerImpl.java:1461) [artemis-server-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:66) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_222]
at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
Caused by: java.lang.NullPointerException
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.scanForMessageSection(AMQPMessage.java:357) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.getBody(AMQPMessage.java:319) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.toCore(AMQPMessage.java:703) [artemis-amqp-protocol-2.9.0.redhat-00005.jar:2.9.0.redhat-00005]
... 10 more
Now try with --protocol amqp specified:
/artemis browser --user admin --password admin --destination TEST1.FORWARDED --verbose --protocol amqp
Executing org.apache.activemq.artemis.cli.commands.messages.Browse browser --user admin --password admin --destination TEST1.FORWARDED --verbose --protocol amqp
Home::/home/user/amq/amq-broker-7.4.1, Instance::/home/user/amq/containers/741CR1
Consumer:: filter = null
2019-08-24 11:29:36,514 INFO [org.apache.qpid.jms.sasl.SaslMechanismFinder] Best match for SASL auth was: SASL-PLAIN
2019-08-24 11:29:36,563 WARN [org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder] Open of resource:(JmsConnectionInfo { ID:c723999e-9e4c-45ad-99bb-13bd6f441bfb:1, configuredURI = amqp: //localhost:61616, connectedURI = null }) failed: Open failed unexpectedly.
2019-08-24 11:29:36,573 INFO [org.apache.qpid.jms.sasl.SaslMechanismFinder] Best match for SASL auth was: SASL-PLAIN
2019-08-24 11:29:36,600 INFO [org.apache.qpid.jms.JmsConnection] Connection ID:4bc04ad2-4322-4238-8594-1d67e37081b0:2 connected to remote Broker: amqp: //localhost:61616
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 trying to browse 1000 messages
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 browsing THIS IS A GENERIC TEST MESSAGE
...JmsTextMessage { org.apache.qpid.jms.provider.amqp.message.AmqpJmsTextMessageFacade@585a1911 }
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 browsing SECOND TEST TEXT MESSAGE
...JmsTextMessage { org.apache.qpid.jms.provider.amqp.message.AmqpJmsTextMessageFacade@69003269 }
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 browsed: 2 messages
Consumer ActiveMQQueue[TEST1.FORWARDED], thread=0 Browser thread finished
I have also attached the camel route code, in case it is needed.