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: 
alex_bundschuh
Product and Topic Expert
Product and Topic Expert
4,439

In this blog post, I like to describe how to apply the pipeline concept on Cloud Integration for implementing an integration scenario containing multiple receivers and multiple receiver interfaces. I will first show you how the scenario is configured in SAP Process Orchestration, and then go through the main implementation steps to get the scenario run on Cloud Integration leveraging the pipeline concept.

For an introduction to the pipeline concept, see this intro blog post. If you haven't gone through the basics of the pipeline concept, I strongly recommend to first read the introduction blog post before proceeding.

Source Integrated Configuration Object in SAP Process Orchestration

The integrated configuration object example on SAP Process Orchestration combines both receiver determination with multiple receivers and interface determination with multiple interfaces. It defines a recipient list pattern whereas each receiver may receive multiple messages.

The message contains an item in JSON format like in the example message below.

 

{
    "ns0:Item":{
        "@PurchaseOrderNumber":"99202",
        "@OrderDate":"2019-05-06",
        "@ItemNumber":"10",
        "ProductId":"HT-1000",
        "ProductName":"Keyboard XX",
        "Category":"Keyboards",
        "Quantity":"10",
        "CurrencyCode":"EUR",
        "Price":"799.00"
    }
}

 

In a REST sender adapter, the JSON format is converted into XML.

 

<?xml version='1.0' encoding='UTF-8'?><ns0:Item xmlns:ns0="http://demo.sap.com/eip/recipient-list" PurchaseOrderNumber="99202" OrderDate="2019-05-06" ItemNumber="10">
  <ProductId>HT-1000</ProductId>
  <ProductName>Keyboard XX</ProductName>
  <Category>Keyboards</Category>
  <Quantity>10</Quantity>
  <CurrencyCode>EUR</CurrencyCode>
  <Price>799.00</Price>
</ns0:Item>

 

As you can see from the Integrated Configuration Object in the Integration Directory of SAP Process Orchestration, the sender communication component equals IFSplit_Sender_5 with sender interface si_item_async_ob.

The xpath condition depends on the product category whereas a context object named category of the service interface is used. The conditions may apply to multiple receivers. If no receiver is found, the message is sent to the default receiver RL_Receiver_1.

02_01_ReceiverDetermination.png

For the first receiver, three conditions are defined to determine the receiver interfaces. Depending on the message payload, the receiver may receive multiple messages.

02_02_Receiver1InterfaceDetermination.png

For the second receiver, only one receiver interface with no condition is defined.

02_03_Receiver2InterfaceDetermination.png

For the third receiver, three conditions are defined to determine the receiver interfaces. Depending on the message payload, the receiver may receive multiple messages.

02_04_Receiver3InterfaceDetermination.png

For the fourth receiver, three conditions are defined to determine the receiver interfaces. Depending on the message payload, the receiver may receive multiple messages.

02_05_Receiver4InterfaceDetermination.png

For the fifth receiver, only one receiver interface with no condition is defined.

02_06_Receiver5InterfaceDetermination.png

Target implementation in Cloud Integration

We would like to model and run the scenario on Cloud Integration applying the pipeline concept. Prerequisite is that you have deployed all generic integration flows as well as the script collection from the integration package provided.

To set up the scenario using the pipeline, the Partner Directory entries need to be created as well as the scenario-specific integration flows. In our case, inbound conversion from JSON to XML is needed. So, we need to create the scenario-specific inbound processing, inbound conversion, and outbound processing integration flows as copies from the provided templates.

The partner ID to store the inbound conversion end point in the Partner Directory needs to be set to IFSplit_Sender_5~si_item_async_ob. During message processing, the generic integration flow Pipeline Generic Step02 - Inbound Processing reads the end point from the Partner Directory and dispatches the message to the very scenario-specific inbound conversion flow.

 

{
    "Pid": "IFSplit_Sender_5~si_item_async_ob",
    "Id": "InboundConversionEndpoint",
    "Value": "/pip/03/scenario1"
}

 

The partner ID to store the receiver determination XSLT mapping in the Partner Directory needs to be set to IFSplit_Sender_5~si_item_async_ob as well. During message processing, the generic integration flow Pipeline Generic Step04 - Receiver Determination reads the XSLT from the Partner Directory and then runs it to determine the number of receivers the message should be sent to.

The XSLT mapping to determine the list of receivers is defined as follows whereas the context object of the service interface has been resolved:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <ns0:Receivers xmlns:ns0="http://sap.com/xi/XI/System">
     <ReceiverNotDetermined>
       <Type>Default</Type>
       <DefaultReceiver>
         <Service>RL_Receiver_1</Service>
       </DefaultReceiver>
    </ReceiverNotDetermined>
    <xsl:if test="/*:Item/Category = 'Software'">
      <Receiver>
        <Service>RL_Receiver_1</Service>
      </Receiver>
      <Receiver>
        <Service>RL_Receiver_2</Service>
      </Receiver>
    </xsl:if>
    <xsl:if test="/*:Item/Category = 'Notebooks'">
      <Receiver>
        <Service>RL_Receiver_3</Service>
      </Receiver>
      <Receiver>
        <Service>RL_Receiver_4</Service>
      </Receiver>
      <Receiver>
        <Service>RL_Receiver_5</Service>
      </Receiver>
    </xsl:if>
    </ns0:Receivers>
  </xsl:template>
</xsl:stylesheet>

 

For the first receiver, the partner ID to store the interface determination XSLT mapping in the Partner Directory equals IFSplit_Sender_5~si_item_async_ob with id interfaceDetermination_RL_Receiver_1. During message processing, the generic integration flow Pipeline Generic Step05 - Interface Determination reads the XSLT from the Partner Directory and then runs it to determine the receiver interfaces.

Note: With version 1.0.6 of the provided package Process Integration Pipeline - Generic Integration Flows & Templates we had to do an incompatible change of how the partner id is defined to retrieve the interface determination XSLT. This is due to the lengths restriction of the partner id of 60 characters. Before, the partner id was IFSplit_Sender_5~si_item_async_ob~RL_Receiver_1, now it's IFSplit_Sender_5~si_item_async_ob and we concatenated the receiver name to the end of the id, see above. By the way, we now also support alternative partner which is even a better approach, here you can define a scenario name and map the sender and the interface to this very scenario name. See New Pipeline Concept features: new partner id definition, alternative partner, bypass option. You may also check out this github repository where I describe how to setup the Pipeline for Cloud Integration for a couple of sample scenarios using alternative partner.

The XSLT mapping to determine the receiver interfaces for the first receiver is defined as follows:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <ns0:Interfaces xmlns:ns0="http://sap.com/xi/XI/System">
    <xsl:if test="/*:Item/ProductName = 'Word'">
      <Interface>
        <Index>1</Index>
        <Service>/pip/07/scenario1/rcvidx1/ifidx1</Service>
      </Interface>
    </xsl:if>
    <xsl:if test="/*:Item/Quantity = '10'">
      <Interface>
        <Index>2</Index>
        <Service>/pip/07/scenario1/rcvidx1/ifidx2</Service>
      </Interface>
    </xsl:if>
    <xsl:if test="/*:Item/Quantity != '10'">
      <Interface>
        <Index>3</Index>
        <Service>/pip/07/scenario1/rcvidx1/ifidx3</Service>
      </Interface>
    </xsl:if>
    </ns0:Interfaces>
  </xsl:template>
</xsl:stylesheet>

 

For the second receiver, the partner ID to store the interface determination XSLT mapping in the Partner Directory equals IFSplit_Sender_5~si_item_async_ob with id interfaceDetermination_RL_Receiver_2. The interface determination contains one receiver only with no condition, so the XSLT mapping to determine the interfaces is defined as follows:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <ns0:Interfaces xmlns:ns0="http://sap.com/xi/XI/System">
      <Interface>
        <Index>1</Index>
        <Service>/pip/07/scenario1/rcvidx2/ifidx1</Service>
      </Interface>
    </ns0:Interfaces>
  </xsl:template>
</xsl:stylesheet>

 

For the third receiver, the partner ID to store the interface determination XSLT mapping in the Partner Directory equals IFSplit_Sender_5~si_item_async_ob with id interfaceDetermination_RL_Receiver_3. The XSLT mapping to determine the interfaces is defined as follows:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <ns0:Interfaces xmlns:ns0="http://sap.com/xi/XI/System">
    <xsl:if test="(/*:Item/ProductName = 'Lenovo') and (/*:Item/Quantity = '1')">
      <Interface>
        <Index>1</Index>
        <Service>/pip/07/scenario1/rcvidx3/ifidx1</Service>
      </Interface>
    </xsl:if>
    <xsl:if test="(/*:Item/ProductName = 'Lenovo') and (/*:Item/Quantity = '2')">
      <Interface>
        <Index>2</Index>
        <Service>/pip/07/scenario1/rcvidx3/ifidx2</Service>
      </Interface>
    </xsl:if>
    <xsl:if test="/*:Item/ProductName != 'Lenovo'">
      <Interface>
        <Index>3</Index>
        <Service>/pip/07/scenario1/rcvidx3/ifidx3</Service>
      </Interface>
    </xsl:if>
    </ns0:Interfaces>
  </xsl:template>
</xsl:stylesheet>

 

For the fourth receiver, the partner ID to store the interface determination XSLT mapping in the Partner Directory equals IFSplit_Sender_5~si_item_async_ob with id interfaceDetermination_RL_Receiver_4. The XSLT mapping to determine the interfaces is defined as follows:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <ns0:Interfaces xmlns:ns0="http://sap.com/xi/XI/System">
    <xsl:if test="(/*:Item/ProductName = 'Lenovo') or (/*:Item/ProductId = 'HT-0001')">
      <Interface>
        <Index>1</Index>
        <Service>/pip/07/scenario1/rcvidx4/ifidx1</Service>
      </Interface>
    </xsl:if>
    <xsl:if test="/*:Item/Quantity = '1'">
      <Interface>
        <Index>2</Index>
        <Service>/pip/07/scenario1/rcvidx4/ifidx2</Service>
      </Interface>
    </xsl:if>
    <xsl:if test="/*:Item/Quantity != '1'">
      <Interface>
        <Index>3</Index>
        <Service>/pip/07/scenario1/rcvidx4/ifidx3</Service>
      </Interface>
    </xsl:if>
    </ns0:Interfaces>
  </xsl:template>
</xsl:stylesheet>

 

For the fifth receiver, the partner ID to store the interface determination XSLT mapping in the Partner Directory equals IFSplit_Sender_5~si_item_async_ob with id interfaceDetermination_RL_Receiver_5. The XSLT mapping to determine the interfaces is defined as follows:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <ns0:Interfaces xmlns:ns0="http://sap.com/xi/XI/System">
      <Interface>
        <Index>1</Index>
        <Service>/pip/07/scenario1/rcvidx5/ifidx1</Service>
      </Interface>
    </ns0:Interfaces>
  </xsl:template>
</xsl:stylesheet>

 

You need to create a scenario-specific integration flow for the inbound processing as copy of the templates provided. Here, SAP_Sender and SAP_SenderInterface are maintained accordingly which are then passed to the next integration flows in the sequence of integration flows to read the Partner Directory information.

 02_07_InboundProcessing.png

You need to create a scenario-specific integration flow for the inbound conversion as copy of the templates provided. In our case, we copied the template Pipeline Template Step01 - Inbound Processing At Least Once, see Pipeline Steps. Here, a JSON to XML converter is added.

02_08_InboundConversion.png

For each interface index from the interface determination XSLTs, you need to create an integration flow with ProcessDirect sender adapter and endpoint as defined in the Service node of the XSLTs. According to the integrated configuration object above, the first receiver has three interfaces. For the first and the second index, the integration flow contains a message mapping which maps the item format to another item format. For the third index, the message mapping maps from item to an order format. Below, the outbound processing integration flow for the third interface index of the first receiver is displayed.

02_09_OutboundProcessingExample.png

For the rest of the receivers and interfaces, similar outbound interfaces need to be created. We created all outbound integration flows as copies of the template Pipeline Template Step07 - Outbound Processing Point-to-Point, see Pipeline Steps.

That’s it. If you like to test the integration scenario, you can send the test message above to the entry point of the scenario-specific inbound processing.

In the next blog post, we will cover a special use case, namely a multicast scenario.

4 Comments