Gatling Passing all the feeder data generated into next exec block

I am trying to implement a performance testing for rabbitMQ application. I know there is no official support for the AMQP protocol in gatling. I done a work around and implemented this using Http requests,

`
def publishMessage() = {
repeat(1) {
exec(http(“publish”)
.post(publishUrl).body(PebbleFileBody(“Body.json”)).asJson
.check(status.is(200)))
}
}

def getMessage() = {
repeat(1) {
exec(http(“consume”)
.post(getUrl).body(StringBody(
“”"

{
“count”: “1”,
…//codes
}

“”“.stripMargin))
.check(status.is(200 ),jsonPath(”$[0].payload").saveAs(“payload”)).check(substring(“${uuid}”).exists))
}
}
val scn = scenario("Code ")
.feed(feeder)
.exec(publishMessage())
.pause(5)
.exec(getMessage())
setUp(
scn.inject( nothingFor(5 seconds),
atOnceUsers(5),
rampUsers(10) during (10 seconds))
).protocols(httpConf).maxDuration(1 minute)
`

the above code is working fine for one user, but when i increase the number of users it is breaking randomly (uuid is not matching). Here what i am doing is the uuid from the feeder input to publishMessage() request body is comparing with the response of the getMessage() json response body ,Since the first method is posting data to a queue we cant guarantee which message is going to be published there first when number of users increasing.

So my question is, is there any way i can store all the generated uuid from feeder to a list/Map and compare whether it is present in the second requests(getMessage) response body.

Sadly, this cannot work.
You can’t guarantee the virtual user that will consume the “response” message is the same as the one that sent the “request” one.

Thanks for the quick reply. So is there any way i can implement(may be some workaround ) this using gatling

We have in our documentation a list of third party extensions we’re aware of: https://gatling.io/docs/current/extensions/
There’s one for AMQP. It seems to be actively maintained, even though it’s not up-to-date.
You can try your luck with it.

I tried with the plugin https://github.com/TinkoffCreditSystems/gatling-amqp-plugin by the example provided (RequestReply as mentioned in there)
But here it is not acknowledge the message response(hence failing the test), even though i can see all the messages are being consumed from the queue ( rep-queue-mq) by the test suite.
I am not sure what i am missing here, may be some additional check block.i think i miss some kind of comparison or protocol configuration here ( i tried to figure out whether id exists in response with jsonPath("$.id").exists, but its failing in runtime due to

type mismatch; found : io.gatling.core.check.CheckBuilder[io.gatling.core.check.jsonpath.JsonPathCheckType,com.fasterxml.jackson.databind.JsonNode,String] required: ru.tinkoff.gatling.amqp.AmqpCheck (which expands to) io.gatling.core.check.Check[ru.tinkoff.gatling.amqp.request.AmqpProtocolMessage] bodyString.exists,jsonPath("$.id").exists)

I am fairly new to scala and gatling, so i am not exactly sure of what is causing the issue( seems the plugin is expecting some other type expression: check(bodyString.exists,jsonPath("$.id").exists)).

lass RequestReply extends Simulation{

  val amqpConf: AmqpProtocolBuilder = amqp
    .connectionFactory(
      rabbitmq
        .host("localhost")
        .port(9081)
        .username("usr")
        .password("pwd")
        .vhost("/vhost")
    )
    .replyTimeout(60000)
    .consumerThreadsCount(8)
    .matchByMessageId
    .usePersistentDeliveryMode

  val scn: ScenarioBuilder = scenario("AMQP")
    .feed(idFeeder) /
    .exec(
      amqp("Consume Publish Test").requestReply
        .directExchange("direct.exchange", "direcs.rk")
        .replyExchange("rep-queue-mq") // here i given the queue name where the message is published by the application after processing (this queue is another exchange)
        .textMessage("{\"id\":\"${id}\",\"message\":\"testmessage\"}")
        .messageId("${id}")
        .priority(0)
        .property("content_type", "application/json")
        .check(
          bodyString.exists)

Note : I tried to publish and consume from the same queue …its working there.( tried to print the response in this case and found the below output as expected.

Response body:
{“id”:“10020”,“msg”:“test”}
Response body:
{“id”:“10021”,“msg”:“test”}
Response body:
{“id”:“10022”,“msg”:“test”}

.check(
        bodyString.exists,bodyString.saveAs("BODY"))
  ).exec({session =>
  val response = session("BODY").as[String]
  println(s"Response body: \n$response")
  session
})

You won’t find help on third party plugins here.
This group is only for official components.
Please reach authors on this third party project’s Github bugtracker.

Thanks Stephane.Will check with the authors :slight_smile: