Technical Articles
EIPinCPI – Process Manager
Previous – Routing Slip | Index | Next – Message Broker
This week, we’ll study a routing pattern known as Process Manager.
When do I use this pattern?
Routing Slip is used when the required steps are known beforehand. When the steps are based on the intermediate state of the message, the Process Manager pattern can be applied.
Process Manager in CPI
CPI alone can’t implement the Process Manager pattern fully. We would need to implement Process Manager using SAP Cloud Platform Workflow and invoke it from CPI. Let’s change the section title.
Process Manager in CPI Cloud Platform
Here’s an example of a scenario where the Process Manager pattern can be applied. Customer places an order through Website. CPI receives the Order payload and triggers the Order Process Manager. Inside Process Manager, the order is sent to the ERP system to check stock availability. If stocks are not available, the process ends there. If stocks are available, the Process Manager sends the order for delivery to CPI and CPI routes it to correct Delivery System. Now, the Delivery System informs the Process Manager (through CPI), whether the delivery was successful or not. If delivery was not successful, the optimistic algorithm keeps retrying to redeliver infinitely. If delivery is successful, the invoice is generated.
Workflow
Integration
Here, the individual steps of Sending the Order to ERP system, triggering the Delivery, checking the Delivery Status, and generating the Invoice are implemented in CPI.
Capturing the Order from Website
This integration flow exposes the Process Manager to the Website using the HTTPS Sender Adapter. The Website sends the Order to trigger the process.
Here’s the configuration for HTTP Receiver Adapter (Note that default configurations are omitted here):
Tab | Property | Value |
Connection | Address | Determine the Service Host and concatenate ‘/v1/workflow-instances’ to start a new Workflow Instance |
Connection | Method | POST |
Connection | Authentication | OAuth2 Client Credentials |
Connection | Credential Name | Workflow Credentials |
Sending the Order to ERP system
This integration flow connects the Website with the Process Manager. The Website sends the Order and triggers the Process Manager.
Here’s the configuration of HTTPS Sender Adapter (Note that default configurations are omitted here):
Tab | Property | Value |
Connection | Address | /SendOrder |
Connection | CSRF Protected | Unchecked |
Triggering the Delivery
This integration flow connects the Process Manager with the Delivery System. The delivery system will schedule the delivery of the order.
Here’s the configuration of HTTPS Sender Adapter (Note that default configurations are omitted here):
Tab | Property | Value |
Connection | Address | /Deliver |
Connection | CSRF Protected | Unchecked |
Checking the Delivery Status
Let’s assume that the Delivery person can log into Delivery System through a handheld machine. Once the delivery is done or not done, the delivery system updates the status in the handheld. This triggers the waiting Process Manager.
Here’s the configuration for HTTP Receiver Adapter (Note that default configurations are omitted here):
Tab | Property | Value |
Connection | Address | Determine the Service Host and concatenate ‘/v1/messages’ to trigger the intermediate message event |
Connection | Method | POST |
Connection | Authentication | OAuth2 Client Credentials |
Connection | Credential Name | Workflow Credentials |
Generating Invoice
Finally, the Process Manager triggers the generation of the invoice.
Here’s the configuration of HTTPS Sender Adapter (Note that default configurations are omitted here):
Tab | Property | Value |
Connection | Address | /Invoice |
Connection | CSRF Protected | Unchecked |
Conclusion
Process Manager is a component used to route the message to various steps as required by the process. SAP Cloud Platform Workflow can be used to implement the Process Manager pattern.
References/Further Readings
- Process Manager Pattern in Enterprise Integration Patterns
- SAP Cloud Platform Workflow
- CPI Components
Hope this helps,
Bala