How to proceed if task takes too long

Hi, I need to catch a message, process it and go next. Thus sometimes it takes too long for a message to arrive, and if it doesn’t arrive say in 3 minutes - I’d go next and process it in background. Processing performs some side effects thus hardly affects the context/variables states etc.

How could I achieve that?

My current solution looks like doesn’t process message (updates DB) if message arrives later then in 3m.

message handling is :

void onMessage(message) {
    process = find process by message.repsonse-id

    runtimeService.createMessageCorrelation("message-name")
            .setVariables(Map.of("is-received-message-name", "true"))
            .processInstanceId(processId)
            .correlateWithResult();
}

Hi,

Consider using a non-interrupting, event driven subprocess, your process model could then look like this…

regards

Rob

1 Like

You read my mind @Webcyberrob :laughing: