Using data from a custom feeder

Hi, I’m using gatling 2 M3. Everything seems to be working fine except when I try to use my custom feeder.

object File2Json extends Feeder[String] {

val feedIter = readCsvInStream.iterator //I can’t use feeder(‘path’).csv because i’m doing a lot more work to compose data

override def next(): Map[String, String] = {
val next =
val json: String = next.toJson
Map(“payload” → json)

override def hasNext: Boolean = feedIter.hasNext

val scen = scenario(“Load on server”)
http(“post first round of requests”)
// .body() //what exactly to do here?

setUp(scen.inject(nothingFor(2 seconds), ramp(200 users) over (120 seconds))).protocols(httpConf)

How do I pull the “payload” data (which is simply a String) into each execution cycle as an http request body?

First, just being curious: what kind of work do you do to compose data?

Then, the answer you’re looking for is .body(StringBody("${payload}"))

Dang! I was missing {} around ‘payload’.

For data composition i’m reading a huge csv file and zipping some ids and some fields in my json presentation. If I use default csv feeder, gatling crashes by going out of memory too.

Thanks for the quickie.