Issue with custom feeder after migrating to latest Gatling

Hello! I have inherited the loadtest in my new project and migrated it to the latest Gatling libs (all libs were a few years old), after that all custom feeders are now broken. My knowledge of Scala is limited, can someone please, explain what could be wrong here and how to fix it? Thanks in advance.

  val customFeeder: Iterator[Record[String]] = new Feeder[String] {
    // always return true as this feeder can be polled infinitively
    override def hasNext = true
    private def randLong() = timestamp.nextLong()
    private val timestamp = new Random
    override def next: Map[String, String] = Map("timestamp" -> randLong().toString)


method without a parameter list overrides a method with a single empty one
override def next: Map[String, String] = Map(“timestamp” → randLong().toString)

Honestly, no idea what your problem is. This code is correct.

Same, here, this code works for me.
What is your issue ? The error ?

The only thing, I can think of, right now is about import:
Ensure you have such imports, and you should be fine

import io.gatling.core.Predef._
import io.gatling.core.feeder.{Feeder, Record}
import io.gatling.http.Predef._

import scala.concurrent.duration._
import scala.util.Random
1 Like

Generally speaking, I recommend against using our internal aliases (Record and Feeder here).
Moreover, this code can be written in such a more simple way!

 val customFeeder =
  Iterator.continually(Map("timestamp" -> ThreadLocalRandom.current.nextLong.toString))
1 Like

The issue was fixed by downgrading scala-support from 5.0.0 to 4.5.1

@Stephane thanks a lot for the example of improved code!

Could you please explain what you call scala-support 4.5.1/5.0.0?

I have this lib in my pom (though not sure yet if my project really needs it or not)


No idea why you need this library, but both versions should have as they both depend on Scala 2.13 which is required for Gatling 3.5+.