gatling-kafka-plugin icon indicating copy to clipboard operation
gatling-kafka-plugin copied to clipboard

Failed to build request: No attribute named inputPayload

Open parimaljanagithub opened this issue 2 years ago • 0 comments

I am getting this error when i am running the test with more than 40 request per second for at leat 40second.

---- Errors --------------------------------------------------------------------

producedData-to-kafka: Failed to build request: No attribute n 1 (100.0%) amed 'inputPayload' is defined

I can see messages are getting dropped .

sample code :

val random: Random = new Random(1) def getProducer(lines: String, properties: Properties): ScenarioBuilder = {

val abcdMap = scala.collection.mutable.Map[String,String]();
val it = properties.stringPropertyNames().iterator();
while(it.hasNext()){
  val key:String = it.next();
  val value1:String = ""+ properties.get(key);
  abcdMap +=(key->value1)
}

val kafkaProducer: ScenarioBuilder = scenario("custom-producer")
  .exec(session=>{
    val currentTimeInMs = System.currentTimeMillis().toString;
    val newPayload:String = lines.replace("\"${currentTimestamp}\"", currentTimeInMs)
    val rValue:String = abcdMap(""+random.nextInt(5000))
    val newPayload2 = newPayload.replace("${custom_cid}",rValue)
    val newSession = session.set("inputPayload",newPayload2)
    newSession
  })
  .exec(
    kafka("producedData-to-kafka")
      .send[String](StringBody("${inputPayload}"))
  )
kafkaProducer

}

With high rps its not able to extract the value from session any reason why this is happening ?

parimaljanagithub avatar Mar 03 '23 10:03 parimaljanagithub