Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
sujit_hemachandran
Participant
45,575


Hello Integrators!

 

What is the Multicast Pattern?

 

The Multicast pattern allows to route the same message to a number of endpoints and process them in a different way.

 

Through the use of multicast, a single message sent on the integration pipeline can be received by multiple branches and receivers. Once the message is sent, each branch can filter out the data that is not relevant or apply specification transformation rules.

 

How to Use the Multicast Pattern in SAP Cloud Platform Integration ?

 

The Multicast is represented as a decision icon, or more accurately called as the parallel gateway in BPMN lingo. You can insert the flowstep as shown below:



There are two variants of the Multicast:

 

  1. Parallel Gateway: All branches of the gateway are executed in parallel.

  2. Sequence Gateway: Branches are executed in the order specified in the Properties tab.


 

You can change between the two variants using the context menu of the multicast flow-step (for right-handers, it appears on right-click of the mouse).



An example Integration Flow

 

To understand the multicast pattern better, I shall take the example an Integration Flow and insert a Content Modifier step with a sample XML Payload in its body (shown below). In addition, I shall use a simple mapping step that converts the price and currency from Dollars to Euros.



 

What ways can I use the Multicast pattern?

 

In Integration projects so far, we have seen its usage in the following two ways:

 

Use case 1: Send the message to multiple receivers. A simplified integration flow is shown below.

 



The input and output are demonstrated below. The input comes from the Content Modifier step. The first branch modifies the payload based on the mapping rules and the second one receive



 

Use case 2: Multiple branches of the integration flow requires the same message contents

 

There are cases when you require the same message in different branches of the integration flow. This is a pattern also observed in the SuccessFactors scenario integration with 3rd party systems. In this case, you have to use the Join and Gather step. This shall collect all messages from different branches into one message.Example below:

 



Note: You have to use the Join + Gather step together. A Gather step alone shall not work.

 



Gather flowstep has quite a few options:

 

The Gather step enables you to merge messages from more than one route in an integration process. You define conditions based on the type of messages that you are gathering using the Gather step. You can choose to gather:

 

  1. XML messages of different format

  2. XML messages of the same format

  3. Plain text messages


 

Based on this, you choose the strategy to combine the two messages:

 

  1. XML messages of the same format, you can combine or specify the XPath to the node at which the messages have to be combined.

  2. XML messages of different formats, you can only combine the messages

  3. Plain text messages, you can only specify concatenation as the combine strategy


 

I take the example of XML messages of the same format. For the same payload that I described above, this is the option that I have chosen:

 

So, here I want to combine all the "<part>"nodes and group it under the main "Mobile_menu" node.

Understanding the aggregation strategy can get a little tricky. I would recommend playing around it with different values to get a hand on it.

 



What happens in case of Error?

 

The quality of service applied by default is "Stop on Exception". In the Message Monitoring, it always shows as a Failed message. Few combinations exist:

 

  • If you have a Join+Gather step and one of the incoming branches (parallel or sequential) fails, then the processing is stopped.

  • When the multicast is connected to multiple receivers, then the successful branches shall receive the message correctly. However, the overall message in the monitoring shall still be shown as Failed.

  • In a sequential multicast, if a branch fails to execute a message - then the processing is stopped with an exception thrown.


 

That is it for this blog. So, try out the multicast pattern and use it in your scenarios!

 

Best Regards,

Sujit

10 Comments