How to define listener port? - jms

I'm using a JMeter with JMS Point-to-Point sampler, and I've a MQ queue with listener port 2222 (non standard 1414). JMeter retrieves queue connection details from IBM WebSphere Application Sever by Provider URL, and connection factory class: com.ibm.websphere.naming.WsnInitialContextFactory
My question is: How to define that port number in to JMeter plugin? Because I've got in
JMeter logs messages about trying to create connection to 1414?

Try going to:
Start by adding the sampler JMS Point-to-Point to the Point-to-Point
element (Add --> Sampler --> JMS Point-to-Point). Then, select the JMS
Point-to-Point sampler element in the tree.
and than set the property:
Provider URL tcp://$HOSTNAME:$PORT

Related

how to pass JMSDestination for ActiveMQ in the JMS request headers through JMS point to point sampler using JMeter?

We are using JMS point to point sampler for sending messages to different artemis queues in JMeter, while sending the request we need to pass the same queue as used in JNDI properties for JMSDestination in the request headers for JMS point to point sampler.
For expample if we have queues A, B and C. For first execution queue used should be A and JMSDestination in the JMS request headers should be JMSDestination ActiveMQQueue[A], for second execution queue used should be B and JMSDestination in the JMS request headers should be JMSDestination ActiveMQQueue[C], for third execution queue used should be B and JMSDestination in the JMS request headers should be JMSDestination ActiveMQQueue[C]?
We are facing issue only with JMS request headers all other places are reading the queues correctly, any solution for this will be much helpful.
how to pass the parameters in JMS request headers while JMS point to point sampler in JMeter?
I don't think it's possible, at least not with JMS Point-to-Point sampler and not with JMeter 5.5
Here is how it's handled currently:
sb.append("JMSDestination ").append(msg.getJMSDestination()).append('\n');
so you cannot overwrite the value unless you amend JMeter source code or develop your own version of the JMS Point-to-Point sampler

JMeter - IBM MQ - Connections Issue

We have been doing performance testing of an application that uses IBM MQ. Through JMeter we are injecting the payload via a JMS Publisher. However, when running the test it can be observed that the connections from the JMeter threads are not being released. This effects the ability to reach the throughput and test failure due to the accumulation of threads. Is there a better alternative than using the JMS Publisher? Or is there setting there that needs to be enabled in order to release the connection once the request has been sent?
https://www.blazemeter.com/blog/ibm-mq-tutorial - Is this the best practice to implement testing IBM MQ?
What are you trying to achieve? JMeter implements Object Pool Pattern so each JMeter thread (virtual user) creates its own JMS connection and on subsequent iterations of the JMS Publisher sampler the Publisher object is being returned from the pool rather than created from zero.
If this is not something you want (or not how your JMS application acts) and you would like to close the connection after posting a message to queue/topic you can achieve it quite easily using JSR223 PostProcessor and the following Groovy code:
def publisher = sampler.publisher
org.apache.jmeter.protocol.jms.client.ClientPool.removeClient(publisher)
org.apache.commons.io.IOUtils.closeQuietly(publisher, null)
sampler.publisher = null

How to send MQ messages (JMS) using 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

JMeter publisher with ActiveMQ failover URL

I have multiple thread groups for pushing message to ActiveMQ using JMeter publisher sampler. My JMeter publisher sampler is configured with ActiveMQ failover URL. When I'm starting the JMeter it is pushing messages to both ActiveMQ irrespective of failover.
The sampler uses the ActiveMQ JNDI initial context factory (org.apache.activemq.jndi.ActiveMQInitialContextFactory)
The Provider URL: failover:(tcp://host1:61616,tcp://host2:61616)
The connection factory is simply the default one provided by ActiveMQ: ConnectionFactory.
The destination is the name of the JMS queue where we want to produce the message, prefixed with dynamicQueues: dynamicQueues/MyQueue.
As per Failover Transport documentation:
Using Randomize
The Failover transport chooses a URI at random by default. This effectively load-balances clients over multiple brokers. However, to have a client connect to a primary first and only connect to a secondary backup broker when the primary is unavailable, set randomize=false.
So my expectation is that when you run your test with multiple threads (virtual users) each thread sends message to the random broker.
If you want to target the first broker and use the second one only if the first one fails - consider appending ?randomize=false parameter to your failover URL like:
failover:(tcp://host1:61616,tcp://host2:61616)?randomize=false
More information just in case: Building a JMS Testing Plan - Apache JMeter

WSO2 ESB Proxy - JMS Message Selector

We have WSO2 ESB listening on to a single ActiveMQ Queue. However we want to configure multiple proxies on listening on to the JMS queue.. however we want the proxy to only consume message meant for it.
Is there a mechanism to set JMS Message selector on the ESB Proxy so that it consumes only message designated for it. ?
Thanks
Rajiv Patil
AFAIK it is not possible to perform such a selection. However there are two possible approaches to achieve the above.
Let each proxy read all the messages and select which to process inside the proxy itself
Use an EIP pattern to achieve the above. One possible pattern would be Message Routing where you can select the messages and direct the message to the desired sequence or proxy which will do the processing.
Yes, you can have multiple proxy services listening to the same queue, each following a certain JMS MessageSelector. You will have to set the transport.jms.MessageSelector parameter for each proxy like this (value 100 is variable, each proxy service containing a different number):
<parameter name="transport.jms.MessageSelector">account='100'</parameter>
And the Java message producer sending the message to the JMS broker is setting the message selector with:
// this will set a key/value pair as JMS message selector
// 100 should be a variable in your case
message.setStringProperty("account", "100");
This was tested on ActiveMQ 4.7 and WSO2 ESB 4+.

Resources