trying to get SSE example working - can anybody help?

671 views
Skip to first unread message

andrew.ba...@gmail.com

unread,
Jun 4, 2018, 10:49:44 AM6/4/18
to Gatling User Group
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

Stéphane LANDELLE

unread,
Jun 6, 2018, 12:12:16 PM6/6/18
to gat...@googlegroups.com
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)

Stéphane Landelle
GatlingCorp CEO


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

andrew.ba...@gmail.com

unread,
Jun 7, 2018, 3:36:49 AM6/7/18
to Gatling User Group
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.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.

Aniruddha Dongre

unread,
Jan 17, 2019, 3:33:06 PM1/17/19
to Gatling User Group
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?
Reply all
Reply to author
Forward
0 new messages