Gatling - Polling

I’m trying to implement a scenario where I run multiple simulations in parallel. Specifically, a sender and receiver where they take actions one after the other. To do this, I want to implement polling in such a way that the polling constantly runs and checks for certain API results (it could be something in the response body to indicate that the next step can be taken inside the polling).

I’m stuck since I’m not sure if this can be accomplished by 2 scenarios in the same file since " Gatling will run each item within SetUp in parallel where as each item defined in a scenario will be run sequentially".

Explanation on what the polling does: The polling in the sender and the receiver will call the same endpoint and check for different values of the same parameter (eg. state) in the response body to indicate if the next endpoint can be called. The sender and receiver are basically 2 pollers and all that a user will do is only start this process by calling a certain endpoint. The pollers run irrespective of the user and only stop when a certain flag inside the receiver poller is set to true.

I’d really appreciate some help and will provide more clarifications if required!

Thank you

Hi Rish,

Use the below code for polling.

  1. Save the respone of 1st request in below queue name

val queuename = new ConcurrentLinkedQueue[String]

  1. call queue name and save into desired variable to pass on to different action in the desired scenario.
    savedvalue = queuename.poll()

  2. Please note that it will work only both scenarios are on the same injector machine.