0
votes

I am writing a JSR223 sample that simulate an SSE client. Something like that:

import com.ssetest.*
String resp="";

EventHandler eventHandler = eventText -> {
  log.info(eventText);
  resp=resp + eventText + "\n";
    SampleResult.setResponseData(resp,"866");
};

SSEClient sseClient = SSEClient.builder().url("http://localhost:3000/sse").eventHandler(eventHandler)
      .build();
      
sseClient.start();

sleep(10000);

sseClient.shutdown();
SampleResult.setResponseCode("200");

I would like to be able to see the output in the result data tab as messages are coming from the server and not only when the sample complete the execution.

Is it possible to achieve this behavior in JMeter?

Maybe using a custom JSR223 listener that listen to a variable that is getting changed in my JSR223 sampler?

1

1 Answers

1
votes

As per JMeter 5.4.3 it's not possible, the result is being sent to GUI, Listeners and to the .jtl file as soon as the Sampler is finished

If you want to see the progress during SSE client execution you can:

  • use OUT.println('something') to print the incoming messages to STDOUT
  • use log.info('something') to print the incoming messages to jmeter.log

You can take a look at How to Load Test SSE Services with JMeter to learn how to handle onMessage() event so you could print each incoming message