How to publish an Object message via jmeter - jmeter

Jmeter JMS publisher has an option to select the Message Type as Object Message and there is text area saying Text Message or Object Message serialized to XML by XStream.
But I couldn't send a Object message to the Message Broker
If I simple enter an XML in the text area and select the message type as Object Message (Obviously this is wrong :) ). I am getting the following exception
jmeter.protocol.jms.sampler.PublisherSampler: hello com.thoughtworks.xstream.mapper.CannotResolveClassException: hello
at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:79)
How can I send a simple Object message via Jmeter

These tutorials might be useful;
http://wso2.com/library/tutorials/2013/08/how-to-use-apache-jmeter-to-publishsubscribe-to-jms-queuestopics-in-wso2-message-broker/
http://aparnaank.blogspot.nl/2013/06/how-to-use-jmeter-jms-publisher.html

Related

Alternatives of MQJExplorer tool for capturing request and sending response

I have an application which uses IBM MQ to send out the request in a queue manager to a particular system B.
The response corresponding to that request is then received back from system B by the application in a sync call and then further business processing happens.
Since we are working on the offshore region, we do not actually send out the request to system B but rather capture it ourselves using the MQJExplorer tool and send back the response, which kind of simulates the prod. behaviour.
The problem here is, or i would say, the overhead is that we have to manually open the mqjexplorer tool, check the request, take a particular attribute from the request(lets say ID), and send back ID+1 so that the application recognizes the response is for ID-1 request.
I would like to know if this particular thing can be automated, with some other tool, where i can define like whenever any such kind of request is received in for eg: MQ001 queue manager and its REQ queue, just extract the ID attribute, do a ID+1 and send back the response in RESP queue of same qm.
There are a pair of IBM supplied samples that come with IBM MQ:-
amqsreq0.c - Sample C program that puts request messages to a message queue and shows the replies (example using REPLY queue)
amqsecha.c - Sample C program - echo messages to reply to queue
They are supplied to allow you to try out a request/reply application.
You already have the equivalent app to do the job that amqsreq0.c does, and you could adapt amqsecha.c to extract your ID attribute, increment it, and then the sample already has the code to send the reply back.
It can be automated by running as a triggered application too.
If 'C' language is not your thing and prefer Java then have a read of a blog posting I did in 2017. It is a complete request/reply scenario with 2 applications: BEServer01.java and RQClient01.java
You can modify BEServer01.java to your liking (and remove the SQL code). BEServer01.java contains all of the code for getting a request message and sending a reply message. Simply replace the variable 'replyText' contents with the reply message that you want.
If you are not a programmer then there is another option but it does not modify the message contents. MQ Visual Edit has a component called: SIM Server. Its purpose is to simulate a server-side component. You configure what 'request' queue to get the messages from and what the reply message text will be. When a messages lands on the request queue, the SIM Server will retrieve it and send the reply message to the queue & queue manager specified in the MQMD's ReplyToQueueName and ReplyToQueueManagerName fields.

ActiveMQ OpenWire: How can I send the Java custom fields of an Exception thrown in BrokerFilter.send to the client/producer JVM side?

In order to create the functionality of listening on the client (producer/consumer) side to custom Exceptions thrown in broker plugins we're trying to relay a "custom correlation id" created upon message send, attached as property to the message and also attached to a JVM structure together with the callback to be called upon that exception being raised (a listener).
The things works, but the only issue we have is that we cannot send that custom correlation id back as part of the exception - it is a custom field, and by default OpenWire only transmits the stack and the message, is that correct?
What possibilities do you suggest to work this out, and be able to transmit back custom fields/values (other than encoding them in the message)?

org.apache.axis2.AxisFault: Translation error

I get the followwing exception when trying to read a SOAP response from a reply queue on IBM WAS 8.5:
Caught an AxisFault while executing the web service call [org.apache.axis2.AxisFault: Translation error]
org.apache.axis2.AxisFault: Translation error
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
I could not find anything related to this error by googling or on IBM's websites.
Looking at that Utils code in open source, "Translation error" is probably the message being sent back in a SOAPFault from the remote web service. Why the remote service is sending back a SOAPFault isn't apparent. If you turn on trace of org.apache.*=all:com.ibm.ws.websvcs.*=all you'll be able to see the incoming message in the trace and that might give you more information.
We were able to resolve this by un-cheking the option at
Queues > "Your Queue" > Advanced properties
[]Append RFH version 2 headers to messages sent to this destination

Copying MQMessage MQMD values to JMS message

I have a requirement where I have to copy value of MessageID, correlationID, persistence, Expiry and Priority from request MQ message to response. I put the request message in the queue using RFHUtil . but as the message is consumed by the Session beans the messageID of MQMD header changes to some different value -HEXADECIMAL, which is different from the MessageID I put in RFHUTIL.
then I copy the above values from request to response message using set methods,- setJMSMessageID etc. but the values are different once I view the response message.
is this due to MQ to JMS conversion? what can be the solution to this.
Earlier I was using MQ Message and was able to copy all fields from request to response.
MessageID in IBM MQ is always hexadecimal, no matter from which API it is set, Base MQ or MQ JMS.
You don't need to set the MessageID while sending the request message. Let MQ do that for you. MQ will generate a unique message id for the request message. In your session beans, you simply copy the MessageID of the request message to CorrelationID of response message. This way you can correlate request and response messages.
See IBM WebSphere MQ request/reply scenario for more details.
UPDATE
Any value set using setMessageID method is ignored when the message is sent, but the method can be used to change the value in a received message.
As the message ID set by setMessageID method is ignored when a message is sent, an application cannot specify the message ID of an outgoing message. As a consequence, an application cannot receive a message and then forward the same message, or send a different message, with the same message ID as that of the message it has received. See the link:

use messagestore with JSON api

I have create an API in WSO2 ESB that receives JSON messages. I have created a messagestore to store these messages in Message Broker (guaranteed delivery pattern).
Now, the message processor that must read the queue and send the message to the backend REST api, gives the error:
TID: [0] [ESB] [2014-11-21 14:28:46,752] ERROR {org.apache.synapse.message.senders.blocking.BlockingMsgSender} - Error sending Message to url : http://lnx17.redora.local:28080/MZK-DataServices/ProcessJson/cases/newCase {org.apache.synapse.message.senders.blocking.BlockingMsgSender}
org.apache.axis2.AxisFault: Payload could not be written as JSON.
The endpoint is currently defined as an address endpoint with JSON type. I have also tried a HTTP endpoint.
In Message Broker, I cannot see the message, because it is stored as an Object (?)
Any suggestions?
Before sending it to the message store, remove the REST_URL_POSTFIX using a property mediator:
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
Then the message will correctly be transferred.

Resources