Expand my Community achievements bar.

SOLVED

How to pause a workflow, process step untill i get response from 3rd party web service ?

Avatar

Level 1

Hi,

I have a usecase in which I need to be able to halt a workflow (custom process step) for sometime (could even be days), and move forward when a favourable response from a third party service is received.
Ideally from within the workflow process step I would like to be able to delegate control to another OSGI service that interacts with the third party webservice, and when a favourable response has been received, resume the workflow.
Has anyone any idea how this could be achieved?

1 Accepted Solution

Avatar

Correct answer by
Level 8

One simple way of doing this is to have a participant step that represents that waiting period and assign it the admin user. This is how the scheduled activation workflows handle this issue. The first step in the workflow is a process step - in your case it would fire off the request to the web service. You would need to probably store some sort of meta-data on the workflow instance node - a transaction ID of some kind so when the reply come back it can find the workflow again. When you 3rd party service replies you then find the right workflow and advance it to the next step. 

I am assuming this use case requires an asynchronous response and you have some sort of listener that is waiting for a response the comes back at some unknown time. 

The advantage of this approach is that it allows administrators to come in and move along or terminate a workflow if something has gone wrong.  

View solution in original post

1 Reply

Avatar

Correct answer by
Level 8

One simple way of doing this is to have a participant step that represents that waiting period and assign it the admin user. This is how the scheduled activation workflows handle this issue. The first step in the workflow is a process step - in your case it would fire off the request to the web service. You would need to probably store some sort of meta-data on the workflow instance node - a transaction ID of some kind so when the reply come back it can find the workflow again. When you 3rd party service replies you then find the right workflow and advance it to the next step. 

I am assuming this use case requires an asynchronous response and you have some sort of listener that is waiting for a response the comes back at some unknown time. 

The advantage of this approach is that it allows administrators to come in and move along or terminate a workflow if something has gone wrong.