0% found this document useful (0 votes)
12 views20 pages

File_4

Cpi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views20 pages

File_4

Cpi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Define Router

Context
You perform this task when you have to specify conditions based on which the
messages are routed to a receiver or an interface during runtime. If the message
contains XML payload, you form expressions using the XPath-supported operators. If the
message contains non-XML payload, you form expressions using the operators shown in
the table below:

Usage of Operators in Non-XML Conditions

Operator Example

= ${header.SenderId} = '1'

!= ${header.SenderId} != '1'

> ${header.SenderId} > '1'

>= ${header.SenderId} >= '1'

< ${header.SenderId} < '1'

<= ${header.SenderId} <= '1'

and ${header.SenderId}= '1' and ${header.ReceiverId} = '2'

or ${header.SenderId}= '1' or ${header.ReceiverId}= '2'

contains ${header.SenderId} contains '1'

not contains ${header.SenderId} not contains '1'


Usage of Operators in Non-XML Conditions

Operator Example

in ${header.SenderId} in '1,2'

not in ${header.SenderId} not in '1,2'

regex ${header.SenderId} regex '1.*'

not regex ${header.SenderId} not regex '1.*'

Recommendation
We recommend that you ensure that the routing branches of a router are configured with
the same type of condition, either XML or non-XML, and not a combination of both. At
runtime, the specified conditions are executed in the same order. If the conditions are a
combination of both non-XML and XML type, the evaluation fails.

Example:
Payload:
<Products>
<Product>
<CategoryID>1</CategoryID>
<Discontinued>false</Discontinued>
<SupplierID>1</SupplierID>
<UnitPrice>18.0000</UnitPrice>
<ProductName>Chai</ProductName>
<QuantityPerUnit>10 boxes x 20 bags</QuantityPerUnit>
<UnitsOnOrder>0</UnitsOnOrder>
<ProductID>1</ProductID>
<ReorderLevel>10</ReorderLevel>
<UnitsInStock>39</UnitsInStock>
</Product>
</Products>
First condition:

Output:
Second condition:

Output:
Third condition ' default':
Output:
Define Multicast
Context
You can use the Multicast step to send copies of the same message to multiple routes.
You can send copies to all routes at once using Parallel Multicast or in an order of your
choice using Sequential Multicast. This allows you to perform multiple operations on
the same message in a single integration process. Without Multicast, you needed
multiple integration processes to perform this task.

Procedure
1. In the palette, choose (Message Routing), then Multicast.
2. Choose Parallel Multicast or Sequential Multicast based on your requirement and
place the step inside the integration process. Define the message paths based on the
scenario.

Based on the order in which you define the message path, the system assigns names to
each message route branch as Branch 1, Branch 2, and so on.

3. If you want to specify a name for this step, enter the value in Name field.

4. If you are using Parallel Multicast, no further configuration is required for the multicast
step.

5. If you are using Sequential Multicast, you can change the order in which the message
should be sent to the Sequential Multicast branches:

a. Choose Routing Sequence.

b. Select the branch which you want to move up or down in the order.

c. Use Move Up and Move Down buttons to change the order.

The branch name is dependent on the order in which you have defined the message
path. If you change the order, the branch name will not change.

6. Save or deploy the configuration.

Example:
Parallel:
Runtime:

Sequential:
Runtime:

Define End Message Event


An End Message event ends a message
processing sequence.
Context
This is how using an End Message event has an impact on the message status (shown in
the message-processing log).

Note
To catch any exceptions thrown in the integration process and handle them, you can use
an Exception Sub process.
If an exception occurs during the processing sequence, which has been handled in an Exception
Sub process, the message status displayed in the message-processing log is failed.
When there is no error during exception handling, the message status displayed in the message-
processing log is completed.

If you like to configure your integration flow that way that the message status displayed
in the message-processing log is failed (even in case an exception occurs during the
processing sequence, which has been handled successfully in an Exception Sub
process), you have the following options:

▪ Use an Error End event.

▪ Use an Escalation End event (sets message status to Escalated in that case).

Exception Sub Process:

If any error occurs in developed i-flow this Exception Sub-Process, will


generate an email and will send it to the required stakeholders, which we
will configure in MAIL adapter. So, that Support/Monitoring team will
get an alert mail then they will look into the issue and will rectify that
error.

Below is the Exception Sub Process. To create this in i-Flow go to


Pallets ->> Process ->> Exception Sub Process. It will look like below.
Then, Delete End Pallet and add Error End Pallet in place of that.
Because End pallet will end the message whereas Error End Pallet sends
continuous alert mail to support team.

After this go to Pallets ->> Transformation ->> Content Modifier and add it to the Exception Sub Process.
In this Content Modifier, we need to declare variables in the message
header or exchange property and body, which we will get in alert mail.

I am declaring in Exchange Property as shown below

Then we need to write the below message in Message Body as shown


below

Hello Team,

Message has been failed with below error:

Error detail: ${exception.message}

Correlation ID: ${header.SAP_MplCorrelationId}

Message ID: ${property.SAP_MessageProcessingLogID}

Iflow Name: ${camelId}

Date: ${date:now:dd-MM-yyyy HH:mm} / SAP CPI – Tenant Number:


${property.SystemName}

Thanks & Regards,

SAP CPI Team


After this, again go to Pallets ->> Call ->> External Call ->> Send and
add it to the flow. This Send request is used to configure a service call to
the receiver system.

Again, go to Pallets ->> Participant ->> Receiver add this Receiver to


the flow and connect this with Send request by using MAIL adapter

Configure the Mail adapter as below


With this, we have competed creating Exception Sub Process. After
deploying this i-Flow if any error occurred it will send an alert mail, like
below.

Note: I wontedly kept some error in this i-Flow to show the alert mail as
below.

I will make some error in adapter like this:


Process Direct Adapter
Use Process Direct adapter (sender and receiver) to establish fast and direct
communication between integration flows by reducing latency and network overhead
provided both of them are available within a same tenant.
Second one:

You might also like