Hello!
Welcome to the gatling community!
As I understand your example, you have 2 different kinds of users:
For me, different kinds of users should be coded as 2 different scenarios.
class SseSimulation extends Simulation {
val httpProtocol = http
.baseUrl("http://localhost:9000")
.acceptHeader("text/event-stream")
val userCount = 1000
val scnListener = scenario("SSEConnect")
.exec(sse("Connect")
.connect("/api/streamEvents")
)
.rendezVous(userCount)
.await(30.seconds)(
sse
.checkMessage("Check event")
.check(regex("""\{"data":"(.*)"\}"""))
)
)
.exec(sse("Close").close)
val scnSender = scenario("SseSender")
.exec(http("My call to API")
.post("/api/send/event/endpoint")
.body(StringBody("Call ${currentTimeMillis()}")))
)
setUp(
scnListener.inject(rampUsers(userCount).during(10.seconds)).protocols(httpProtocol),
scnSender.inject(nothingFor(15.seconds).atOnceUsers(1)).protocols(httpProtocol)
)
}
Note: I didn’t test the code myself
Note the currentTimeMillis to be able to check and compare time of sent event, and received event in your listener user.
Hoping it helps
Cheers!
--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/e11406da-2f1e-4131-8d99-9ce3fa9f2397n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/02550e15-6570-4093-b498-571a3323458an%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/bddff929-7565-42b7-9b37-5f5c743767a8n%40googlegroups.com.