Hi,
I’ve taken some example code from - https://gatling.io/docs/current/http/sse/
and tried various things to get it working but it always complains - [ERROR] i.g.h.a.a.s.SseClose - ‘sseClose-1’ failed to execute: Couldn’t fetch open sse: No attribute named ‘gatling.http.sse’ is defined
Here is the code -
package sseexampleapp
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
//import io.gatling.jdbc.Predef._
class BasicSimulation extends Simulation {
val httpConf = http
.baseURL(“http://localhost:8888”)
sse(“sseexampleapp”).sseName(“myCustomName”)
val scn = scenario(“Server Sent Event”)
.exec(
sse(“sseexampleapp”).open("/")
// .check(wsAwait.within(30).until(1).regex("""“Server says hi”"""))
)
.pause(15)
.exec(sse(“sseexampleapp”).close())
setUp(scn.inject(atOnceUsers(1))).protocols(httpConf)
}
I commented out the check but it makes no difference one way or the other.
The example app I’m trying to get it to talk to is from -
https://gist.github.com/jareware/aae9748a1873ef8a91e5
Any help appreciated - Andy Baker
Don’t really have time to test with Gatling 2 OSS atm.
No attribute named ‘gatling.http.sse’ means that your SSE stream couldn’t be stored in the Session, which can happen for several reasons:
- request failed
- you forced a specific sseName, but then forgot to use the same name and used the default (‘gatling.http.sse’) instead. This is exactly what you do when calling “close”: you use the default instead of .sseName(“myCustomName”).
Then, your url for open is wrong: it should be /events (check index.html in your sample)
Many thanks,
This works -
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class SSE extends Simulation {
val httpConf = http
.baseURL(“http://localhost:8888”)
val scn = scenario(“Server Sent Event”)
.exec(
sse("").open("/events")
.check(wsListen.within(30 seconds).until(1).regex("(.*)").saveAs(“Test”))
)
.pause(15)
.exec(sse(“Close SSE”).close())
setUp(
scn.inject(atOnceUsers(1))
).protocols(httpConf)
}
Hope it helps somebody get a step off the ground.
I am getting the same error too. Tried doing it your way but still the error persists in my script. To confirm Stephane’s first bullet point, how do I confirm if my request failed or passed?