Correct usage of processUnmatchedMessage in version 3.11.2

Gatling version: 3.11.2
Gatling flavor: java
Gatling build tool: maven


I was very excited to upgrade to Gatling version 3.11.2 and use the processUnmatchedMessages feature.

  1. Please confirm that the below code snipet is correct with ws.processUnmatchedMessages rather than sse.processUnmatchedMessages

  1. Could you please provide a little more guidance as to how use this feature correctly?
public static ChainBuilder checkUnmatchedMessages() {
        return exec(
                // store the unmatched messages in the Session
                        (messages, session) -> session.set("messages", messages)
                // collect the last message and store it in the Session - My understanding is that this is 
               //optional and is there to give an idea of how processUnmatchedMessages could be used
                        (messages, session) ->
                                        ? session.set("lastMessage", messages.get(messages.size() - 1).message())
                                        : session),
                        session -> {
                            System.out.println("this is the unmatched messages: " + session.get("messages"));
                            return session;

I am placing checkUnmatchedMessages() just after the request that triggers the sse event data that I’m trying to capture.The hope here is to see the UnmatchedMessages captured in the session data. However, nothing is being captured. could you please advise wether this is the intended use? I have also placed .sseUnmatchedInboundMessageBufferSize(5) - in my protocol as advised in the documentation.

This is my first query so please be kind. Happy to provide more info if needed. thank you in advance!

  1. there was indeed a typo, ws should have been sse indeed. Thanks.

  2. this probably means that processUnmatchedMessages is being called too soon. You might want to wrap in a loop and iterate until you’ve received what you’re expecting.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.