ActiveMQ to Apollo transition, Openwire to Stomp protocol configuration - activemq

I'm trying to switch from ActiveMQ 5.6 to Apollo 1.5.
I have two soft that are exchanging messages, using publish/subscribe on topics.
The first one is c++ and use openwire with tcp
The second one is Javascript and use stomp with websockets
With ActiveMQ everything worked fine, and the messages I sent could be read and write on both softs, and I didn't changed the clients since.
Now, I send messages from the c++ soft (using openwire), and try to read them with the JS soft, and I get errors. In fact I receive message with header content-type: "protocol/openwire", but I expect stomp.
this is how I configured apollo.xml connector section :
<connector id="tcp" bind="tcp://0.0.0.0:61613">
<openwire max_inactivity_duration="-1" max_inactivity_duration_delay="-1" />
<stomp max_header_length="10000" die_delay="-1" />
</connector>
<connector id="ws" bind="tcp://0.0.0.0:61623">
<stomp max_header_length="10000" die_delay="-1" />
</connector>
I also tried with <detect /> in tcp and ws connector, that is supposed to auto detect client protocol, but dosen't work either.
Does someone can help me to figure this out ?
Thank you,
edit :
I found out that I do receive stomp protocol messages, but they are very weirdly formated, and even contains non text char that make stomp.js fail to parse the message and correctly fill the message body.
here are the same message received once from activemq openwire and then apollo openwire in with the same c++ publisher and js subscriber :
activemq
"MESSAGE
message-id:ID:myID-61443-1352999572576-0:0:0:0:0
class:Message.PointToPoint
destination:/topic/my-topic
timestamp:1352999626186
expires:0
subscription:sub-0
priority:4
<PointToPoint xmlns="Message" ><SourceId>u_23</SourceId><TargetId>u_75</TargetId></PointToPoint>"
apollo
"MESSAGE
subscription:sub-0
destination:
content-length:331
content-type:protocol/openwire
message-id:xps-broker-291
Eç{#ID:myID-61463-1352999939140-0:0emy-topicn{#ID:myID-61463-1352999939140-0:0; Å??<PointToPoint xmlns="Message" ><SourceId>u_23</SourceId><TargetId>u_75</TargetId></PointToPoint>(class Message.PointToPoint
"
Do you think it could be a problem in Apollo ?

ActiveMQ 5.6 handles translating the logical OpenWire messages into a text representation for STOMP clients. Apollo, currently does not support that feature yet! :( See:
https://issues.apache.org/jira/browse/APLO-267
It just takes the full openwire message and uses it as the body of the STOMP message. BTW using binary data in a STOMP message is totally valid as long as the content-length header is properly set.

Related

JMeter cannot read messages using JMS Subscriber, giving me 404 status code as a response

I'm trying to read messages from ActiveMQ Artemis using JMeter. For that I use JMS Subscriber. For some reason I can't read messages, it gives me an 404 response code. I think that I'm making everything correct, but it doesn't works. Here is what have I done.
and here is the response.
my ActiveMQ looks like that:
The problem was in Destination field. I should have use dynamicQueues/GDE.Error instead of dynamicTopics/GDE.Error .

Apache camel / MQTT through SSL : Failed to create Producer for endpoint (java.lang.NullPointerException)

I'm trying to publish to a MQTT topic thanks to the appropriate Apache Camel MQTT component.
So in my spring context XML I have the following:
<camel:to uri="mqtt:test?host=ssl://myhost:8883&publishTopicName=test&userName=test&password=test"/>
But I'm getting the following error at startup :
Failed to create Producer for endpoint:
Endpoint[mqtt:test?host=ssl://myhost:8883&publishTopicName=test&userName=test&password=test]. Reason: java.lang.NullPointerException
Everything is working fine when not using ssl, the following configuration (regular tcp instead of ssl) is working well :
<camel:to uri="mqtt:test?host=tcp://myhost:1883&publishTopicName=test&userName=test&password=test"/>
I've added the javax.net.ssl.trustStore JVM property pointing to my certificates store but without any effect.
Does someone already met this issue ? Is there something to specifically add in the spring DSL configuration file when using the camel mqtt component with ssl ?
EDIT :
The stacktrace of the NPE :
Caused by: java.lang.NullPointerException at
org.fusesource.hawtdispatch.transport.SslTransport.connecting(SslTransport.java:194)
at
org.fusesource.mqtt.client.CallbackConnection.createTransport(CallbackConnection.java:285)
at
org.fusesource.mqtt.client.CallbackConnection.connect(CallbackConnection.java:138)
at
org.apache.camel.component.mqtt.MQTTEndpoint.connect(MQTTEndpoint.java:305)
at
org.apache.camel.component.mqtt.MQTTProducer.doStart(MQTTProducer.java:38)
at
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at
org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3219)
at
org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:1209)
at
org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:1170)
at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:442)
... 33 more
Debugging through javax.net.debug=ssl was useful.
Actually there were an issue on the java.security where the security.provider property was not set properly. That was manually changed for testing purpose related to another application.
Since, everything is working fine. Sorry for the post related to a internal specific mistake.
Alex.

Mule web service consumer over JMS

I need to consume WS that's using JMS as a transport rather than HTTP.
The Web Service Consumer doc says that it supports JMS but no any example provided unfortunately of using the component with non HTTP transports.
Need help with this subject. These are the steps I've done:
The wsdl has been successfully loaded by the connector wizard in anypoint. I've specified the method to be called. The parameters were recognized by DataSense so I can see the input parameters with DataMapper etc.
The URL looks like this: jms:queue:toOrderManagement?replyToName=fromOrderManagement?targetService=OrderManagement
I've defined global JMS connector like this:
<jms:connector name="JMSConnector" specification="1.1" username="user"
password="******" validateConnections="true" doc:name="JMS">
<reconnect-forever />
</jms:connector>
and associated it with the WS connector like this:
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="myOrder.wsdl"
service="OrderManager" port="JMSOrderManager"
serviceAddress="jms:queue:toOrderManagement?replyToName=fromOrderManagement?targetService=OrderManagement"
doc:name="Web Service Consumer" connector-ref="JMSConnector"/>
So, how to specify the actual JMS queue name and what the format of the serviceAddress attribute when it's configured for JMS/WS?
Ok, it took me some time to get the answer on this.
So, first, the format of the servcieAddress should be like this:
jms://${toQueue}?exchangePattern=request-response
where toQueue is the "request" queue name i.e. the one the request will be sent to.
Now, if you don't specify any additional parameters, a temporary "response" queue will be automatically created and WS Consumer will be waiting for receiving the response from it.
If you wanna use a pre-configured queue for getting responses then, before calling the WS Consumer, you need to set the message property JMSReplyTo with the response queue name to be used. If the property is set then WS Consumer will wait for the response from that queue rather than from the temporary one.

What for a message browser would be available for activeMQ?

Is there a message / queue browser for activeMQ available?
I tried Hermes JMS, but it is not working for activeMQ 5.10, anymore.
We need a browser where we can export a message into XML.
Any suggestions?
Thanks and regards.
You can try hawtio which is a web console that has plugins for various technologies, such as ActiveMQ.
hawtio is created by the people who also created Camel and ActiveMQ and thus has great plugins for those.
http://hawt.io/
Hermes is able to connect to AMQ but perhaps you need to use older AMQ libs on the client/hermes side, like v5.7.0 or similar.
Hawt.io is great to read/move/browse/delete/send messages but you may need additional tools to export/import data.
You cannot export a JMS message to XML in a generic way. What you can do is to export the payload to a file (which may be XML).
To export messages into a files, you can use a command line tool called A. Then you can write a -b tcp://localhost:61616 -c 20 -o file.xml MY.QUEUE and you will have 20 messages exported to file-1.xml, file-2.xml .. file-20.xml.
Disclaimer: I am the author of "A".

How to be sure that channel.basic_publish has succeeded (internet connection error, ...)?

Im doing this :
channel.basicPublish("myexchange", "routing", MessageProperties.PERSISTENT_TEXT_PLAIN,
"message".getBytes());
I would like to retry later to send the message if the publish didn't succeeded (connection loss, ...) but basicPublish is a void function and there is no callback in the arguments
Any idea ?
You are looking an HA client,
By default you have to implement the feature by your self.
If you use java there is :
https://github.com/joshdevins/rabbitmq-ha-client (it's just a bit old but it think it still work).
Anyway, if you want implement the functionality you have catch the exception and re-try later.
If the client lose the connection you should re-connect the client before re-send the message.
On the version 3.3.0 the last features is implemented by default to the java client:
java client
enhancements
14587 support automatically reconnecting to server(s) if connection is
interrupted
This point is very important you want send the messages sequentially.
A simple solution is put the messages in a client list and then remove the message from the list only if the message has been sent correctly.
I think you could find interesting also the Publisher Acknowledgements