JMS - Items Not going to out Queue - jmeter

I am using the JMeter JMS Publisher to send an item to a display - OK, but when I validate the item using JMS Subscriber it errors with 404 ? Looking at the JMS browser they are in the In Queue but not buffering to the out Queue ? I can force it through the JMS browser but cannot understand why the JMS subscriber part is not working ?
Any help would be appreciated.

Looking into JMS Subscriber Source code
if (sampleCounter == 0) {
res.setSuccessful(false);
res.setResponseCode("404");
res.setResponseMessage(sampleCounter + " samples messages received, last try had following response message:"+
res.getResponseMessage());
JMeter returns status 404 when the subscriber gets 0 results on attempt to consume the messages from the queue.
If you see the messages in the queue using the browser application it means that your JMS Subscriber configuration is not correct.
You can enable debug logging for JMeter's JMS protocol by adding the next line to log4j2.xml file:
<Logger name="org.apache.jmeter.protocol.jms" level="debug" />
Once done you should see the JNDI configuration, queue names, etc. so you could cross-check it with the values in the JMS Browser application and amend JMeter configuration to match it.

Related

Junk Chars sent in message body when sending MQ message using jmsTemplate in Spring

I am using jmsTemplate to send messages to MQ Queue. When the consuming MQ application gets the message they are able to see junk chars like below in message. I need to remove them as they are causing parse exception.
WS-OUTPUT-BUFFER:RFH �����*����4MQSTR ������Ï´���∑∞_é¥û∞(Ω¥û|_Ω™æµ¬æ∞(Ω¥û∞_é¥û∑∑���ë∞|_Ωû∞ÖΩæûêÛµÛµÈä§É†âÉ
Ñ<…§(â§+äàâäà†&<·∞ÖΩæû∞ä_Ωû⁄fl‡Â›Âfi„fi∞ä_Ωû∞Ñ•¥û§ÖÈ雵¥„fiŸé›µ¥„µfiŸfiŸfiŸfiŸfiŸfiŸfiŸfiŸ¥‡éfiflé›∂éé„„fi„⁄Ÿ∞Ñ•¥û∞Ö%¿û∞Ö
%¿û∞|_Ωû���∫∞ÛΩºû∞ÑÑâ§Ö∑¥æ±•fiû„⁄Â∞ÑÑâ§Öû∞∂/•%§∂ÇÛ•µΩéµ∑¥æ±•fiû⁄∞∂/•%§∂ÇÛ•µΩéµû∞µ>é?¥•>è∑¥æ±•fiû›∞µ>é?¥•>èû∞ÛΩ
ºû∑∑∑<?xml version="1.0" encoding="UTF-8"?>
I had a similar issue when the receiving application could not handle the MQRFH2 header.
Therefore I had to set the TARGCLIENT (short TC) property with WMQ_CLIENT_NONJMS_MQ (value 1) on the JMS Destination object like this:
<Resource
name="jms/YOUR.QUEUE.NAME"
auth="Container"
type="com.ibm.mq.jms.MQQueue"
factory="com.ibm.mq.jms.MQQueueFactory"
QU="YOUR.QUEUE.NAME"
TC="1"/>
See also Exchanging messages between a JMS application and a traditional IBM MQ application.

Inserting messages in a JMS queue and then sending back the acknowledgement using Spring Integration

I have a service which receives xml messages via an http inbound adapter and then transforms them into text that becomes the content of an email that gets sent out.
I now need to first insert these messages into a JMS queue and send the acknowledgement back as a 200 ok after the message is inserted into the Q and then carry-on with the rest of the processing.
<int-http:inbound-channel-adapter channel="inputChannel"
id="httpInbound"
auto-startup="true"
request-payload-type="java.lang.String"
path="/message"
supported-methods="POST"
error-channel="logger" >
<int-http:request-mapping consumes="application/xml" />
</int-http:inbound-channel-adapter>
<int:chain id="chain" input-channel="inputChannel" >
<int:service-activator ref="mailTransformerBean" method="transform" />
</int:chain>
The service-activator takes care of the processing to convert the xml into an email.
Before that I need to incorporate a JMS Queue into which the received messsages will be inserted and then the acknowledgement is sent back. This is so as to retain the messages and retry in case of a failure of the service.
I would like to set this up as a Transaction with the JMS queue as a endpoint.
How do i approach this?
If you are seeking something like a in-process persistence storage, take a look, please, into the SubscribableJmsChannel :
The channel in the above example will behave much like a normal <channel/> element from the main Spring Integration namespace. It can be referenced by both "input-channel" and "output-channel" attributes of any endpoint. The difference is that this channel is backed by a JMS Queue instance named "exampleQueue".

How to check whether Active MQ is up in continuous intervals in mule esb?

I have message in one queue and need to send to other queue(destination) both are active MQs. When destination is down message will be in source Queue. I need to check in continuous intervals whether destination is up r not. if it is up I need to send to destination. I'm facing difficulty in checking the destination availability..,
please help me., Thanks..,
I think in general, this kind of problem is best solved using transactions.
I'm assuming you are working with two different ActiveMQ brokers, which leads to the chance that the destination queue is not available.
In the simplest case, you could accomplish your goal this way:
Start JMS Transaction
Receive message from queue A on broker 1
Do any required logic and/or transformation
Publish message to queue B on broker 2
If successful, commit your JMS transaction
If not, rollback your JMS transaction
Example:
<flow name="simpleExample">
<jms:inbound-endpoint queue="queueA" connector-ref="broker1">
<jms:transaction action="ALWAYS_BEGIN"/>
</jms:inbound-endpoint>
<flow-ref name="doLogic" />
<jms:outbound-endpoint queue="queueB" connector-ref="broker2">
<jms:transaction action="ALWAYS_JOIN" />
</jms:outbound-endpoint>
</flow>
When the rollback occurs, this method will immediately retry. If you want to control how long to wait before trying again, configure the redelivery policy on the ActiveMQ connector for Broker 1.

Why does my camel route try to reply to the JMS consumer?

I have an Apache Camel route configured in Spring which takes a message from a JMS (ActiveMQ) queue, transforms the message and uses the CXF component to send the results to a web service. This all works fine but I always get an exception thrown at the end of the route that the CXF response object isn't synchronizable, referring to the fact that it's trying to convert the exchange/message body back into a JMS message. But why?
Here's my camel context extract:-
<route>
<from uri="jms:queue:transactions" />
<process ref="convertToFormatForCXF" />
<to uri="cxf:bean:myService?defaultOperationName=process" />
<stop />
</route>
and here's a snippet from the logs:-
EndpointMessageListener WARN Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - java.lang.RuntimeException: net.sophis.soa.dataexchange.LogoutResponse]
org.apache.camel.RuntimeCamelException: java.lang.RuntimeException: net.sophis.soa.dataexchange.LogoutResponse
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1363)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:124)
Even the doesn't prevent the stack trace. Now I've found out that if I add the disableReplyTo=true to the JMS consumer then the stacktrace doesn't show which is excellent.
I suppose I'm just trying to work out what was happening? Was the CXF response object going to be added to the 'transactions' JMS queue? My intention was for the flow to stop once the CXF producer had completed.
Can anyone help my understanding please? The Camel documentation wasn't much help on this.
Was the CXF response object going to be added to the 'transactions' JMS queue?
No. It would have been added to a temporary queue.
From http://camel.apache.org/jms.html#JMS-Request-replyoverJMS
The JmsProducer detects the InOut and provides a JMSReplyTo header with the reply destination to be used. By default Camel uses a temporary queue, but you can use the replyTo option on the endpoint to specify a fixed reply queue (see more below about fixed reply queue).
Camel will automatic setup a consumer which listen on the reply queue, so you should not do anything.

How to stop exception propagation if jms broker is down when sending a message with spring integration?

I configured spring xml based interceptor, which sends a jms message to activemq queue on each invokation of some transactional method after it is commited. It's happening with the following xml code.
<jms:outbound-channel-adapter channel="filteredStakesChannel" destination="stakesQueue" delivery-persistent="true" explicit-qos-enabled="true" />
But if the activemq server is down i get connection refused exception, which is propagated and i don't want this to happen even if the jms delivery fails. Is this possible?
Should i use some error-channel?
The simplest solution is to make fileredStakesChannel an Executor channel and the send will run on a different thread.
http://static.springsource.org/spring-integration/reference/html/messaging-channels-section.html#executor-channel
http://static.springsource.org/spring-integration/reference/html/messaging-channels-section.html#channel-configuration-executorchannel
Use the <task/> namespace to define an executor to use.

Resources