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

2,267 views
Skip to first unread message

Ganesh Selvaraj

unread,
Apr 22, 2015, 4:36:11 PM4/22/15
to gat...@googlegroups.com

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

John Arrowwood

unread,
Apr 23, 2015, 5:51:43 PM4/23/15
to gat...@googlegroups.com
Try something more like:

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

Stéphane LANDELLE

unread,
Apr 27, 2015, 5:15:00 AM4/27/15
to gat...@googlegroups.com
Hi,

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

Stéphane Landelle
Lead developer


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ganesh Selvaraj

unread,
Apr 27, 2015, 1:47:13 PM4/27/15
to gat...@googlegroups.com
Thanks for the response. I do made good progress by seeing the builtin support.


My use case
------------------

1) Read the message properties from CSV.

2) Configure JMS for Active MQ.

3) Match the request and response by CorrelationID.

4) Receive the request from queue and route the response to topic.


//Code Snippet

val feeder = csv("test1.csv").circular

 val jmsConfig = jms

   .connectionFactoryName("ConnectionFactory")

   .url("tcp://localhost:61616")

   .contextFactory(classOf[org.apache.activemq.jndi.ActiveMQInitialContextFactory].getName)

   .listenerCount(1)

   .matchByCorrelationID


 val scn = scenario("Load Queues")

           .feed(feeder)

           .exec(jms(" Load Testing")

           .reqreply

           .queue("queue-name")

           .replyDestination(topic("topic-name"))

           .textMessage("This is my test message")

           .property("PROPERTY_1", """${property1}""")

           .property("PROPERTY_2", """${property2}""")

     )


  setUp(scn.inject(atOnceUsers(10)).protocols(jmsConfig))



Ganesh

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/DufyHB0vxak/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages