A common use-case with process management and external interfaces is that you want to invoke a long-lived process from a short-lived process. For example an external system is calling your process, you want to return a success/fail response, and start a human-workflow within workspace. You implement the webservice via a short-lived process, and the human-workflow via a long-lived process with user tasks.
By default you can only call a long-lived process from another long-lived process; in this blogpost I will give you some options to achieve this:
If you want to know more when to choose for long-lived or short-lived process, read this blogpost.
Option 1: Watch-folder
To implement this via a watch-folder you create a file with the right payload in your short-lived process, and put that in a particular folder.
In this case you have to configure your long-lived process that it will “watch” that folder, you will have then a watched folder starting point.
Option 2: Events
Events are available out-of-the-box for short-lived and long-lived processes. In this use-case the short-lived process would “throw” an Event, the long-lived process would have a starting point that catches the event.
Option 3 : Code (executeScript / customComponent)
Another option you have is to invoke a process via code (either an executeScript or a custom component). In this case the short-lived process would execute this code to invoke the long-lived process :
ServiceClientFactory fact = ServiceClientFactory.createInstance();
ServiceClient client = fact.getServiceClient();
Map params = new HashMap();
InvocationRequest req = fact.createInvocationRequest(“YourApplication/LongLivedProcess”, “invoke”, params, false);
Option 4: Webservice
The last option is to use the webservices that are exposed for all processes. In this case you call from your short-lived process the webservice of the long-lived process. You don’t have to configure your long-lived process in a particular way, it will have a normal starting point.
As you can see there is not just one way of implementing this, and per application you can choose to use a different way of implementing this.