SAP NW BPM Collect Pattern Aggregate messages based on counter and Timer
Scenario Description: The requirement is to collect certain number of messages or to collect messages for certain amount of time from source system and once one of the condition is fulfilled send the aggregated message to target system.
The BPM will either accept 10 messages or it will accept messages for 2 min.
Please refer below blog for connectivity between PO & BPM as well as for ESR and ID design part.
Here we will need 2 ICOS.
1)To send messages to BPM (PO -> BPM)
2)To receive aggregated messages from BPM (BPM -> PO)
BPM process view
Service Interfaces: Import 2 service interfaces from PO.
DO_Count: Total number of messages received in BPM.
DO_UtilsTmeSersERPItmBulkCrteReqMsg: To store the received data in start step/to store intermediate messages within BPM. It is created from UtilsTmeSersERPItmBulkCrteReqMsg.
Start Step: Trigger to BPM/Initiate BPM instance.
Store the received message from PO into DO_UtilsTmeSersERPItmBulkCrteReqMsg.
Initialize DO_Count variable.
Intermediate Timer: Set offset to120 seconds.
Next_Message: If count < 10 then wait for next message.
Start_Trigger will be used here as we are aggregating same structure message.
We will append new message to existing message.
Mapping: Increment counter by 1.
Uncontrolled Merge: once any of the condition is fulfilled send the messages to automated activity. It will act as OR GATE.
Exclusive Choice: To check whether the counter reached to 10 or not. If not then go to getMessages gate to collect messages, else continue with send gate.
Automated Activity: To send aggregated messages to PO.
End: To terminate/stop the process.
The development part is completed now deploy the process to PO Server.
BPM Testing And Monitoring:
NWA->Configuration->Process and Tasks->Process Repository
Test scenario using WS Navigator:
Click on web service Navigator. It will open below page. Fill the input/Request parameters / import xml file.
Click on Invocation Parameters.
Click on ok and then click on Invoke to trigger BPM. The status of message will be displayed on same page after clicking on invoke button.
Send 10 xml messages from WS navigator or send less than 10 messages within 2 min.
1) Send 10 messages but within 2 min (Counter = 10).
2) Send less than 10 messages but wait for 2 min to complete process(Timer = 120 Seconds).
NWA -> Operations -> Process and Tasks -> Manage Process.
Go to context data tab and select the DO/variable from dropdown.
That’s it. we have successfully developed, deployed and tested NWBPM scenario.
Hope this blog post will be helpful for someone having similar requirement.
Thank You !!