In this post I will tackle a task of sending a simple text JMS message to a Oracle AQ queue using JMeter. Next week, I will follow that with a description of what to do to send a JMS byte message in JSON format. Stay tuned for that one.
There are two samplers in JMeter which can do a job of sending a message to a queue: JMS Point-to-Point and JMS Publisher. The decision of which one to use might depend on your use case and which JMS messaging model is used by your project.
Below I will show you how to utilize the JMS Point-to-Point sampler. I’m not forgetting the other sampler though, JMS Publisher will make an appearance in the next post.
Initial Configuration
-
ojdbc.jar (version of the ojdbc library depends on the Oracle DB version you use e.g. Ojdbc7 can be used for Oracle 11g, Ojdbc8 for Oracle 12c etc. )
-
aqapi.jar
-
jta.jar
-
jndi.properties.jar, that you will need to create by yourself:
db_url=jdbc:oracle:thin:@${dbHost}:${dbPort}:${dbSID}
jar cf jndi-properties.jar jndi.properties
How to configure the JMS Point-to-Point sampler
Just substitute the variables you can observe in the screenshot with following values:
-
connectionFactory = QueueConnectionFactory
-
initialContextFactory = oracle.jms.AQjmsInitialContextFactory
-
destinationQueueName = your destination queue
-
queueUsername = your username
-
queuePassword = your password
-
jdbc:oracle:thin:@${queueHost}:${queuePort}:${queueSID} = connection string to your Oracle database
And we are done! It is as simple as that.
Different ways of providing message
Of course you don’t need to hard-code the message completely in the sampler’s “Content” field like above, but can parameterize it or read it from a file.
- parameterization of the message:
- to read a message from a file you can use JMeter’s StringFromFile function:
${__StringFromFile(c:\path_to_file.txt)}
- to read a message containing some variables and substitute it with values in the runtime use eval function:
${__eval(${__StringFromFile(c:\path_to_file.txt)})}
1 comment on "Using JMeter to send a text message to Oracle AQ queue"