0

We have two events in the BPM. One makes a call to a microservice and ends. The microservice will respond with completion and the another event will capture the completion response.

But sometimes, the completion response is received even before the second event is dispatched. This results in errors. Apart from asking the microservice to resend the response again, is there any better approach to decrease the time taken by the dispatcher to call the second event?

Kindly let me know.

brate
  • 3
  • 3

1 Answers1

0

I'm trying to follow what you are doing. I think you are making a call from BPM to the micro service and then going to a message event to wait for the micro-service to respond, and the problem you are seeing is the event from the micro-service is issued before the BPM engine is at the "wait" event and so the message gets lost.

First I'll mention it sounds like maybe this doesn't belong at a Business Process level as it feels more like an integration problem than a Business Process problem, but sometimes we don't get to pick our tools.

While I've not done this in Flowable, I know how I'd solve it in some of the other BPM Engines. The issue (if the above is correct) is that we really want to make sure we are waiting for the response before it can happen so that we don't miss it. Defined that way the model is pretty straight forward. I'd do the following -

  1. Insert a split before the micro-service invocation.
  2. On the branch from the split that goes to the micro service insert a timer event with a very low wait time (e.g. ~5 seconds)
  3. On the other branch, put your listen event. Since it doesn't have a timer, it should be waiting before the micro service is invoked.
  4. Put a join in between the micro service call and the listener. Now you will move forward after 2 things are true a) you have invoked the MS call and b) you have received the response from that invocation.
Drux
  • 486
  • 2
  • 6