Excuse me for novice questions, but how can I model a process so that it can always have an open connection to receive http requests? Another system may at any point send to my process messages that I want to catch.
The http connectors is only to send http requests, right? So, what about receiving?
Maybe I haven’t understood correctly some concepts.
Good point @StephenOTT! I was also thinking of that since I have implemented it on a project where I have an open websocket connection to receive messages which can trigger the message start event in the sub process.
But maybe I didn’t make it clear. The question is how to have a listener to catch http requests send by another system? In the other project, as I said I have a websocket client with a listener to catch the messages. But now that the other system can only send http request messages, how can I catch them?
You can use the /message endpoint to send you messages. But be away of possible race events where the system is sending you message too quickly (usually sub second responses)
In the User Task, I have a “create” Task Listener to send an http request to another system to perform the task.
At any point I want to receive a “message/notification/event/something” from that other system (external to my process) that the task is complete. Once I receive it, I will call the task/complete API to complete the task.
From /message API documentation, I should receive a message like this:
I explain above what I try to achieve with the message start event in the Event Subprocess. It’s about a message call from the API to trigger the completion of a Task.
But how do you think should I pass the “taskInstanceId” in the message body? I would like to avoid it as a process variable because the matching may be wrong if at the same time two messages arrive and the process variable is updated two times (only the last value will be kept).
How can I make it work with correlation keys? Any suggestion?
You could also use a start execution listener on an external service task to inform your external systems that there is some work, but I would recommend the (long) polling approach that is described in the linked resource.
I was also considering External Tasks but not sure if the “external system” can implement the “fetchandlock” logic (well, it’s not difficult with the API but I’m not sure whether I want to let the external system do it).
In the example I provided above, I use the Message API to catch a message in a Message Start Event in an Event Subprocess (actually, the Message API is called by another system, external to my application).
The call of the API gives a result like the following: