Type mismatch; found : Unit required: io.gatling.core.structure.ChainBuilder (Active MQ message producer)

Hi

I am new to Gatling and trying to send Messages to a Active Queue. I would like to repeat the scenario using repeat but am getting the below error. Can anyone help me with that?

//Code

class TestLoaderDsl extends Simulation {

def sendMessage={
val connectionFactory = new ActiveMQConnectionFactory(“url”)
val connection = connectionFactory.createConnection();
connection.start
val session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)
val destination = session.createQueue(“mercury-load-gatling”)

val producer = session.createProducer(destination)
val message = session.createTextMessage()
message.setText(“Hello from GATLING”)
producer.send(message)
connection.close
}

println(“Before sending message”)
val scn = scenario(“JMS DSL test”).repeat(1) {sendMessage}
println(“After sending message”)
println(“Exit TestLoaderDsl”)
}

//Error

mulation.scala:27: type mismatch;
found : Unit
required: io.gatling.core.structure.ChainBuilder
16:33:03.545 [main][ERROR][ZincCompiler.scala:109] i.g.c.ZincCompiler$ - val scn = scenario(“JMS DSL test”).repeat(1) {sendMessage}
16:33:03.546 [main][ERROR][ZincCompiler.scala:109] i.g.c.ZincCompiler$ - ^
16:33:03.586 [main][ERROR][ZincCompiler.scala:109] i.g.c.ZincCompiler$ - one error found

Try something more like:

repeat(1) { exec( session => { sendMessage; session } ) }

Hi,

We have builtin support for JMS: http://gatling.io/docs/2.1.5/jms.html

Thanks for the response. I do made good progress by seeing the builtin support.

My use case