I'm new to testing with Gatling and JMS. Long term I'll be looking for Gatling to just have a JMS listener waiting for JMS message to be put on a queue from our AUT, but for now I'm just playing in a sandbox to try and get to grips with Gatling's JMS handling. I've been looking at the various examples that googling threw at me, and the best I've come up with is as follows:
package jmspublisher
import io.gatling.core.Predef._
import io.gatling.jms.Predef._
import javax.jms._
import scala.concurrent.duration._
class WebProducer extends Simulation{
// create a ConnectionFactory for ActiveMQ
// search the documentation of your JMS broker
val connectionFactory =
new org.apache.activemq.ActiveMQConnectionFactory("tcp://localhost:61616")
val jmsUsername:String="admin"
val jmsPwd:String="admin"
val jmsConfig = jms
.connectionFactory(connectionFactory)
.usePersistentDeliveryMode
.matchByCorrelationId
val scn = scenario("JMS DSL test").repeat(1) {
exec(jms("req reply testing").requestReply
.queue("jmstestq")
.replyQueue("repQueue")
.textMessage("hello from gatling jms dsl")
.jmsType("textMessage")
.check(simpleCheck(checkBodyTextCorrect)))
}
setUp(scn.inject(atOnceUsers(1))).protocols(jmsConfig)
def checkBodyTextCorrect(m: Message) = {
print ("here")
print (m);
// this assumes that the service just does an "uppercase" transform on the text
m match {
case tm: TextMessage => tm.getText == "HELLO FROM GATLING JMS DSL"
case _ => false
}
}
}
I can see in my activeMQ console the two queues get created, a message is enqueued on jmstestq
, and repQueue
has one listener connected during the run - but repQueue
never seems to get the message from jmstestq
, and so the response is never picked up, and the check never happens.
I'm sure I'm missing something simple - but what is it?!
Are you sure you have a sample AUT that reads from repQueue and then writes a response message in repQueue? If not, Gatling is simply waiting for a response that will never arrive.