Sometimes we come across such a requirement where in we need to send messages to multiple receivers, either sequentially or simultaneously, from BPM. Through this blog I will explain how we can achieve this in BPM using Receiver Determination and Block Step.
Receiver Determination Step: –
Receiver Determination step in BPM gives back the list of receivers configured, for the corresponding message interface, in the Integration Directory and put into a multiline container element of type Receiver.
Design of BPM
1) Receive step: abstract asynchronous interface used to receive a file
2) Transformation step: To convert receiver message interface into sender interface (it is referring a one to one mapping).
3) Receiver Determination step: To determine the receiver for sender interface.
4) Block step: To send sender message to multiple receivers.
5) Send step: To send message (within the Block step).
For the sake of simplicity I have used an abstract asynchronous message interfaces as Sender and Receiver Interface. In order to differentiate between sender and receiver message, I have defined two container elements referring to same message interface. As shown in Fig. 2.
Define two conatiner elements, Receiver_List and Receiver_Single, of type Receiver, Receiver_List is defined as the multiline element for dynamic processing and container element Receiver_Single is defined for the current line. This gets the individual receivers for which the block will be executed.
Set the properties of Receiver Determination Step as shown in following figure.Also check the Create New Transaction to see this step at runtime.
Set the properties of the Block Step as shown in following figure: –
For the Send Step, in properties window select Receiver List in Receiver From, and mention Single line container element of type Receiver (i.e. Receiver_Single) in Receivers. At runtime this send step will use Receiver_Single to determine the receiver. Shown in following figure: –
Import BPM into Integration Directory. Mention multiple receivers into the Receiver Determination corresponding to the Send step of BPM.
Remaining configuration in Integration Directory, needs to be done as per standard configuration procedure, according to scenario.
In order to verify whether the receivers, mentioned in Integration Directory, are reflected in Receiver Determination Step of BPM at runtime, we need to go to SXI_MONITOR. In SXI_MONITOR click on PE -> Go To -> List With Technical Details (Shift + F9) and select the Receiver Determination Step.
Case 1: Send one after the other
To send message to multiple receivers one after the other, Mode of Block Step is set to ForEach.
As we have mentioned two receivers in Integration Directory, Receiver_List will have two entries, i.e.BS_Service and BS_FILE. Hence , Block Step will execute twice in sequential(i.e loop) order ,as mode is set to ForEach.
Case 2: Send simultaneously
To send message to multiple receivers simultaneously, Mode of Block Step is set to ParForEach.
As we have mentioned two receivers in Integration Directory, Receiver_List will have two entries, i.e.BS_Service and BS_FILE. Hence , Block Step will execute twice in parallel(i.e branch) order ,as mode is set to ParForEach.
Application of the this design
- You can send a message to multiple receivers in parallel by specifying more than one receivers in Receiver Determination of Integration Directory. But if you want to multicast the message to multiple receiver one after another than you can use Receiver Determination step in BPM, using this design.
- In case if you want to design a logic based on the number of receivers for instance if you want to set a loop with respect to the number of receivers then also you can go for this design. We can refer to the BPM design in fig 1, in which the block will execute as many times as number of receivers in the Receiver Determination step.
I hope this blog gives you an understanding of how to use Receiver Determination and Block step to multicast messages from BPM.