How to send MQ messages (JMS) using JMeter - jmeter

I have to put messages in a queue for which I have all the connection details (host, port, channel, manager, queuename and username). I never worked on implementing JMeter for sending MQ. Can anyone let me know where can I get (blog or reference) step by step procedure to perform this? I tried referring to official site, can't really understand those JNDI, connection Factory settings

Man, your MQ statement is too general as there are too many possible message queue system providers like Apache ActiveMQ, RabbitMQ, IBM MQ, TIBCO, etc. and the values for all these JNDI/JMS properties, connection factory names, queue names, etc. will be different.
To get an overview of Java communication with "MQ" get familiarized with Getting Started with Java Message Service (JMS)
Download .jar files for your MQ system and put them to JMeter Classpath
Perform configuration as per your MQ system connection settings, example setup for Apache ActiveMQ is here: Building a JMS Testing Plan - Apache JMeter

Related

IBM Liberty message consumption with fail-over

We are designing a solution that will consume messages from IBM MQ using JMS. The plan is to use WAS Liberty, so JMS is the technology of choice. We will create Message-Drive beans that will listen for messages in MQ queues.
We are considering both WAS Liberty and OpenLiberty as well.
The trick here is that we must implement it with fail-over, so that if one of our server fail, the other will keep consuming messages from MQ automatically. Like in a ative/passive mechanism.
I'm aware that the MQ adapter needs to be installed as it is not provided out-of-the-box.
I have the following questions:
Does WAS Liberty messaging implementation supports fail-over? Meaning that if the ative message consumer node fails, the stand-by node will automatically migrate and start consuming messages from MQ? What about OpenLiberty?
How can I configure the message system to work that way? Can you point out to the documentation?
Or is this feature only provided by WebSphere?
There is no such functionality in WebSphere Liberty or Open Liberty yet. You can create RFE here https://www.ibm.com/developerworks/rfe/?PROD_ID=544 .
There are ways to do it manually, check these links:
JMS Activation spec on Liberty: “WAS_EndpointInitialState” full profile equivalent property?
Controlling the state of endpoints at runtime
Solution that you could do:
create a script/application that will monitor your servers and call that API to enable/disable endpoint in specific server
or use Dynamic cluster/ auto scaling feature of Liberty and divide you app to two clusters - one with MDBs, one without. And then define policy that MDBs cluster has 1 instance always available. So once the server dies it is automatically restarted somewhere in the cluster
or use Kubernetes/ICP platform in the same way - so deploying 2 versions of app, and defining different replicasets parameters.

Trying to use jms publisher/subscriber in jmeter to connect to IBM MQ

We have been using jms point-to-point sampler in jmeter to post an xml based request to the MQ. Since then our application has changed and now the messages that are posted to the MQ are Serialable objects created with spring integration. To have a test around this, we tried using jms publisher/subscriber. All the online support we tried is pointing to connection to ActiveMQ. Has anyone tried using jms published to post object message to and IBM MQ?
The online approach gives you all the elements to switch to IBM MQ.
You would need to:
put IBM MQ jars in lib folder of jmeter
Find the infos needed for :
http://jmeter.apache.org/usermanual/component_reference.html#JMS_Subscriber
http://jmeter.apache.org/usermanual/component_reference.html#JMS_Publisher
This will help you:
http://leakfromjavaheap.blogspot.com/2014/07/jmeter-and-websphere-mq-series.html?_sm_au_=iVV5P5vR626sDt7V

Not able to create jms queues in websphere programatically using standalone java client

I wrote a java client to connect to jms in websphere.
I was able to connect and produce and consume message.
Problem I am facing is when I do Session.createQueue(), websphere jms is not creating a new queue.
Please could some one throw some light on this issue...
Thanks in advance...
If you are working with WebSphere MQ as the messaging provider within WebSphere Application Server the queue will need to be created on the WebSphere MQ QueueManager first. This can be done either via the graphical WMQ Explorer or via the command line using the 'runmqsc' tool.
Information can be found for these via the WMQ InfoCentre - suggest doing a websearch for "WMQ Library" to get the latest link, currently though it is http://www-01.ibm.com/software/integration/wmq/library/index.html
Topics though don't need to be pre-created - though they can be if required. Various properties can be set different to the default.
If the Queue doesn't need to be permanent, for example as a temporary reply to then look into creating a temporary queue from the JMS Connection.
createQueue doesn't create a new queue. It simply creates a javax.jms.Queue object from a vendor specific identifier. javax.jms.Queue objects are just references to existing queues. Typically, you retrieve javax.jms.Queue objects from JNDI; createQueue is only useful in scenarios where using JNDI is not possible or not desirable.
Note: there is one exception to this, namely JMS providers that support autocreation of queues (I think ActiveMQ has such a feature).

to view all websphere MQ messages in JMS call

I use JMS (Java Message Service API) in my java application to work with queues/topics residing on websphere MQ. I am looking for a tool/support pac which can show me all MQ Messages being called e.g. when I do queueConnectionFactory.createConnection(), it would have resulted into MQCONN/MQCONNX call, so I need to see what excatly is being passed. So basically during my entire JMS based interaction, I want to see all MQ messages which are being passed to. Is it possible?
if you are using websphere, you can turn on tracing by going to WAS console and tracing service to enable jms logging.
Trace tells you what APIs are being called. To a good extent trace helps. But beyond that call IBM help.
If you are using JMS MQ client mode connection it is possible to run send/receive exits on the MQ SVRCONN channel to log the client MQI and message flows. The free IBM SupportPac MA0Z has this capability. This technique is not possible with a binding mode connection because there is no MQ channel involved.

How to create physical queue in JMS at run time

Want to know how to create physical queue in JMS at run time.
when I search for this I got Creating JMS Queues at runtime
But when I read http://activemq.apache.org/how-do-i-create-new-destinations.html I come to know queue which mention in Creating JMS Queues at runtime is not creating any physical queue at server side.
Please correct me if I m wrong. If any one know to create physical queue at run time please replay.
Thanks in advance.
The creation of "normal" queues is not adressed by the JMS standard. Depending on what you want to do there are two approaches:
use temporary queues -> however they have many restrictions, most commonly they are used forrequest-reply scenarios
use the API of the JMS provider - however your solution will be depending on this specific provider then
The JMS standard only addresses sending and receiving data from objects like queues and topics. Creation of JMS artefacts is vendor specific and most often requires using:
1)specific vendor APIs (not JMS)
2)command/admin messages aimed at the JMS server (command agents on activemq)
3)JMX API
I have used JMX method, which is the most powerful, but also the most work.
JMX Method for activemq (version 5.0+)
a) JMS Server Setup
1) Enable JMX in activemq startup scripts and activemq.xml files
2) If you are authenticating to to the server, make sure your user has admin privileges setup in activemq.xml (see http://activemq.apache.org/security.html)
3)restart activemq server
b) Your Client Code
1) create an instance of org.apache.activemq.broker.jmx.BrokerViewMBean (you will need to connect with some JMX connectivity code which is a bit messy)
2) use its addQueue method. This will create a queue on the server
(The process is similar for hornetq but since you mentioned Activemq I have omitted hornetq details here.)
I have used this method myself and it works.
An alternative is to use Command Agents in Activemq, but I have no personal experience with these. These are special messages contain admin commands and may do what you want as well.

Resources