Initiat java String in each interation

Hi all

i have a java public class that generate a ID link to timestamp that will be use to be send in my Gatling script

My question is how to pass into my exec as a feed , knowing that it is a String

I tried to use it as below but it is initat only once and it is the same for all users ,

How to call the class on each iteration for each users so the GereateID will be different everytime

val generateID = javaclass.String()

val scn = scenario(“Scenario Name”)
.exec(Request.request(generateID))

setUp(
scn.inject(
constantUsersPerSec(10) during (3 minutes)
)
).protocols(httpProtocol)

Regards

You must redesign your code so that your Request.request takes a Function<Session, String>, not a String.

Hi Stéphane

Thanks for your reply

Could you please be more explicit if possible ?

Because i also tried Session approche but it not seems to work

val scn = scenario(“Scenario Name”)

.exec{ session =>
val generateID = session(javaclass.string()).as[String]
session
}
.exec(Request.request(generateID))

object Request {

def request(generateID: String): ChainBuilder =
{
exec( …)
}

}

Regards