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

**URL:** <https://community.gatling.io/t/type-mismatch-found-unit-required-io-gatling-core-structure-chainbuilder-active-mq-message-producer/2231>\
**Category:** Gatling (Open-Source)\
**Created:** [April 22, 2015, 8:36pm UTC](https://community.gatling.io/t/type-mismatch-found-unit-required-io-gatling-core-structure-chainbuilder-active-mq-message-producer/2231 "2015-04-22T20:36:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ganesh\_Selvaraj](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@Ganesh\_Selvaraj](https://community.gatling.io/u/Ganesh_Selvaraj)\
**Post date:** [April 22, 2015, 8:36pm UTC](https://community.gatling.io/t/type-mismatch-found-unit-required-io-gatling-core-structure-chainbuilder-active-mq-message-producer/2231/1 "2015-04-22T20:36:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jarrowwx](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jarrowwx](https://community.gatling.io/u/jarrowwx)\
**Post date:** [April 23, 2015, 9:51pm UTC](https://community.gatling.io/t/type-mismatch-found-unit-required-io-gatling-core-structure-chainbuilder-active-mq-message-producer/2231/2 "2015-04-23T21:51:43Z")

</div>

Try something more like:

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 27, 2015, 9:14am UTC](https://community.gatling.io/t/type-mismatch-found-unit-required-io-gatling-core-structure-chainbuilder-active-mq-message-producer/2231/3 "2015-04-27T09:14:59Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![Ganesh\_Selvaraj](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@Ganesh\_Selvaraj](https://community.gatling.io/u/Ganesh_Selvaraj)\
**Post date:** [April 27, 2015, 5:47pm UTC](https://community.gatling.io/t/type-mismatch-found-unit-required-io-gatling-core-structure-chainbuilder-active-mq-message-producer/2231/4 "2015-04-27T17:47:12Z")

</div>

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

My use case
