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?