Using Integration Patterns

Objectives

After completing this lesson, you will be able to:

  • Use integration patterns

Integration Patterns

In this Lesson, the Following Topic is Discussed:

Show Integration Patterns.

Show Integration Patterns

The following integration patterns are included in the example package:

The Integration Patterns in Detail:

Aggregator

To process related individual messages in bulk, you can use an Aggregator pattern. This pattern involves collecting and storing individual messages until a complete set of related messages is received. The aggregated message is then sent to the intended receiver.

Composed Message Processor

The Composed Message Processor pattern is useful when you need to process a message that contains multiple elements, each requiring different processing. The pattern involves splitting the message into sub-messages, routing each sub-message to a different destination, and then re-aggregating the responses back into a single message.

Content-Based Routing

Assuming you have an order process in which the inventory system handling the order depends on the shipping address, you can use content-based routing to direct the message to the appropriate recipient based on its content. In this exercise, we will utilize a content-based router.

Read more here:

Content Enricher

Suppose you need to send an order to a supplier, but you don't have all the required information for the receiver system to process it. For example, the product items only have a category code, and the main category name is missing. In this case, you can use a Content Enricher pattern that reads data synchronously from an external system and appends the missing information to the original message before forwarding it to the receiver.

Content Filter

Assuming you receive an order from a partner in a standardized format with many fields, but your backend system only needs a small fraction of them. You have two options to implement this scenario:

  • Using a Filter step.
  • Using Message Mapping.

Read more here:

Message Filter

You can implement the Message Filter pattern to remove unwanted data from a channel. For example, if you need to send product information to an inventory system, but the inventory system only handles a specific range of products based on product category, you can apply a Message Filter to discard any irrelevant data. The Message Filter is a subtype of the Message Router pattern, with only one receiver channel. It evaluates incoming messages and routes them to the receiver channel only if they meet the specified criteria; otherwise, they are discarded.

Recipient List

Assuming that you want to find the best quote for an order by sending it to several suppliers, but not all suppliers are relevant for every product in the order. In this case, the suppliers that should receive the order are dynamically determined based on the specific products being ordered. To achieve this, you can use the Dynamic Router pattern, which sends a copy of the message to multiple receivers based on dynamically determined criteria. Unlike the content-based router, which forwards the original message to a single receiver, the dynamic router sends a copy of the message to multiple receivers.

Read more here:

Resequencer

If you need to rearrange messages that were received by Cloud Integration in an incorrect order, you can employ the Aggregator pattern. This pattern enables you to gather individual messages in batches that are sorted by sequence number. To transform the message batches back into separate messages, you can use the Splitter pattern and send the individual messages to the intended receiver.

Scatter-Gather

The Scatter-Gather pattern allows you to send a message to multiple recipients and collect their replies. By broadcasting a message to multiple recipients, the pattern enables parallel processing of the message by all recipients. After receiving the responses, the pattern reaggregates them back into a single message.

Splitter

The Splitter pattern can be used when a message contains multiple elements that require different processing. The pattern can break up the message into individual messages based on the number of elements. However, in the given exercise, the Splitter pattern is not utilized.

A distinction is made between the following use cases:

  • Splitting a bulk order message into multiple orders.
  • Splitting a single order with multiple items.

Read more here:

Quality of Service Exactly Once

You want to guarantee that a message is delivered and processed by the receiver exactly once. This requirement can be achieved by combining the following two enterprise integration patterns:

Guaranteed Delivery

The Guaranteed Delivery pattern guarantees that a message will eventually be delivered to a receiver, even if there are temporary failures in the messaging system. However, because of the possibility of redeliveries, this pattern may result in a message being delivered multiple times.

Idempotent Receiver

The Duplicate Message Suppression pattern addresses the issue of handling duplicate messages and ensures that if a component receives the same message multiple times, it processes it only once.

Read more here: Quality of Service Exactly Once

Summary

This lesson describes various integration patterns, including Aggregator, Composed Message Processor, Content-Based Routing, Content Enricher, Content Filter, Message Filter, Recipient List, Resequencer, Scatter-Gather, Splitter, and Quality of Service Exactly Once.

Install Example Integration Flows

Business Scenario

The enterprise patterns, including aggregator, content enricher, and dynamic routing, among others, have specific technical requirements. To learn and apply these patterns effectively, it's useful to have a collection of best practices, tips, and tricks. SAP offers self-study options, such as a complete implementation as integration flow, a comprehensive description on sap.help, and a Postman Collection for testing the deployed integration flows. You can find all this knowledge in the integration flow Design Guidelines, which we can use to implement selected scenarios.

Task Flow

In this exercise, you will perform the following tasks:

  1. Log on to the DiscoverIntegration view.
  2. Search, find, and copy the example integration flows to your Design area.
  3. Check out the documentation.
  4. Check out the help pages.

Prerequisites

A functional Integration Suite → Cloud Integration with an appropriate user is all that is required.

Outcome After This Exercise

The integration flow guidelines were discovered and reviewed.

What do you Learn Within This Exercise?

To gain knowledge about integration patterns, it is highly recommended to locate and explore the integration flow design guidelines, which serve as an excellent source of information.

Exercise Options

To carry out this exercise, you can choose from the following options:

  1. Live Environment: Using the instructions provided below, you can perform the steps in your SAP BTP account.
  2. Platform Simulation: Follow the step-by-step instructions within the simulation.
  3. Side-by-side: Follow the step-by-step instructions within the simulation and perform the steps in your SAP BTP account simultaneously.
Note
We strongly recommend to perform the steps in the live environment.

Task 1: Log On to the Integration View

Steps

  1. Log on to the DiscoverIntegration view.

    1. Navigate to DiscoverIntegrations.

Task 2: Search, Find, and Copy the Example Integration Flows to Your Design Area

Steps

  1. Search for Examples.

    1. Into the search bar, enter Examples, and choose the magnifying glass icon to search for examples.

    2. Locate the 8 Integration Flow Design Guidelines.

  2. Copy the content of Integration Flow Design Guidelines - Learn the Basics to your Design area.

    1. Select the Integration Flow Design Guidelines link from the search result list.

    2. Choose Artifacts (33).

    3. There are more than 30 integration flows available for exploration. Additionally, there is a Documents tab which we will explore later.

    4. On the top right, choose the Copy button to copy the complete package to your Design area.

    5. Open from the left side menu Design > Integrations.

    6. Choose the package Integration Flow Design Guidelines - Learn the Basics.

    7. In this section, you find the tabs Artifacts and Documents.

    8. Choose the Artifacts tab.

    9. First locate the Generic Receiver and choose it. This artifact is a prerequisite for all other artifacts in this package, so it must be installed first.

    10. Use the Action > Deploy button to deploy the Generic Receiver.

Task 3: Check out the Documentation

Steps

  1. Check out the Documentation.

    1. Navigate to the Documents tab.

      • No. 1: The Postman Collection (all needed Messages ready for use out of the box within the HTTP Client postman).
      • No. 2: Jump to the help portal.
      • No. 3: Jump to the installations tutorial for the Integration Flow Design Guidelines.

Task 4: Check out the Help Pages

Steps

  1. Check out the How to Work with the Example Integration Flows (No. 3).

    1. Choose the link How to Work with the Example Integration Flows (No. 3)

    2. Check out this page. We will do the same in the next task.

  2. Check out Package Documentation on SAP Help Portal (No. 2).

    1. Choose the Package Documentation on SAP Help Portal link and access the documentation of each integration flow.

    2. Go to the left side menu and navigate to DevelopmentIntegration Flow Design Guidelines.

      Note

      The Integration Flow Design Guidelines cover several topics, including Decouple Processing, Decouple Sender and Flows Using Persistence, and Decouple Sender and Flows Using JMS Message Queues*.

    3. Refer to this page for the upcoming task where we will implement and execute this scenario.

Install the Postman Collection

Business Scenario

The following steps can be followed to try out selected scenarios and study their mode of operation using the appropriate messages sent to the endpoints of the processes via HTTPS. SAP provides a predefined collection of messages for this purpose. It is also possible to use other HTTP clients, such as Insomnia.

Task Flow

In the task of this exercise, you will perform the following steps:

  1. Download the Postmann Collection JSON file.
  2. Open Postman HTTP Client.
  3. Install the Postman Collection.

Prerequisites

  • The process of creating an HTTP Client to send SOAP messages to an integration flow has been completed.
  • You have completed the task Create an HTTP Client to send SOAP messages to an integration flow using Postman. To use Postman, you need to have it installed on your machine. Alternatively, you can use Insomnia as an alternative to Postman. If you choose to use Insomnia, you can import the JSON Collection of messages.

Outcome After This Exercise

A well prepared Postmann collection is available for testing all the Integration Flow Design Guidelines.

What do you Learn Within This Exercise?

Acquire knowledge on configuring an OData Adapter for your API (API Business Hub Enterprise) and learn how to use it.

Exercise Otions

To carry out this exercise, you can choose from the following options:

  1. Live Environment: Using the instructions provided below, you can perform the steps in your SAP BTP account.
  2. Platform Simulation: Follow the step-by-step instructions within the simulation.
  3. Side-by-side: Follow the step-by-step instructions within the simulation and perform the steps in your SAP BTP account simultaneously.
Note
We strongly recommend to perform the steps in the live environment.

Task 1: Install the Postman Collection

Steps

  1. Download the Postmann Collection JSON file.

    1. Navigate to Integration SuiteDesignIntegrations and open the copied package Integration Flow Design Guidelines - Learn the Basics.

    2. Navigate to tab Documents and choose Modeling Basics - Postman Collection.

      The download of the zipped JSON file ModelingBasics.postman_collection.zip starts.

    3. Unzip this file locally on your computer.

  2. Open Postman HTTP Client with your workspace.

    1. Open Postman HTTP Client and navigate to your workspace DelayedDelivery_Process.

  3. Install the Postman Collection.

    1. In your workspace, choose the Import button.

    2. At the File tab, choose Choose Files and import the ModelingBasics.postman_collection.json file.

    3. Choose the Import button.

    4. You have now imported a new collection within your workspace ModellingBasics.

    5. Now, you have a collection of messages that can be sent to the provided integration flows.

Check out Decoupled iFlows Using JMS

Business Scenario

We aim to understand how to decouple two integration flows. This implies that the sender sends a message synchronously to a process without waiting for the second process to complete. We can also utilize this scenario to practice in our training session.

Task Flow

In this exercise, you will perform the following tasks:

  1. Deploy the Generic Receiver if it has not been deployed yet, following the instructions mentioned earlier.
  2. Explore the Decouple Flows Using JMS integration flow.
  3. Explore the Documentation to Decouple Flows Using JMS.
  4. Deploy, Run, and Trace your process to understand how it works.
  5. Examine other Integration Flow Design Guidelines.

Prerequisites

You have completed the steps for installing the Examples integration flows and the Postman collection.

Outcome After This Exercise

An Integration Flow Design Guidelines instance is up and running for the "Decouple Flows Using JMS" pattern.

What Do You Learn Within This Exercise?

Learn how to use, deploy, run, and trace a sample scenario from the Integration Flow Design Guidelines. After completing this, you can explore all the provided guidelines. If there are any deviations from this procedure, they will be described in the documentation.

Exercise Options

To carry out this exercise, you can choose from the following options:

  1. Live Environment: Using the instructions provided below, you can perform the steps in your SAP BTP account.
  2. Platform Simulation: Follow the step-by-step instructions within the simulation.
  3. Side-by-side: Follow the step-by-step instructions within the simulation and perform the steps in your SAP BTP account simultaneously.
Note
We strongly recommend to perform the steps in the live environment.

Task 1: Deploy the Generic Receiver if it has not been Deployed yet, Following the Instructions Mentioned Earlier

Steps

  1. Find and deploy the Generic Receiver integration flow.

    1. Choose Integration SuiteDesignIntegrations.

    2. Open the Integration Flow Design Guidelines - Learn the Basics package. Switch to the Artifacts tab.

    3. Open the Action button in the Generic Receiver row and choose Deploy.

Task 2: Explore the Decouple Flows Using JMS Integration Flow

Steps

  1. Explore the Decouple Flows using JMS integration flow.

    1. Choose the Modeling BasicsDecouple Flows Using JMS row.

    2. Find and open the Modeling BasicsDecouple Flows Using JMS integration flow.

Task 3: Explore the Documentation to Decouple Flows Using JMS

Steps

  1. Open the help documentation to Modeling BasicsDecouple Flows Using JMS scenario.

    1. Choose the Help icon bottom right.

    2. On the left side menu, find the process Decouple Sender and Flows Using JMS Message Queues, as we have previously done.

    3. Check out the description and understand the idea behind it. Compare the description with the configuration of each design components.

  2. Answer the following questions:

    1. Did I understand the idea?

    2. Does the description match the configuration?

Task 4: Deploy, Run, and Trace Your Process to Understand how it Works

Steps

  1. Deploy your integration flow.

    1. Go back to your open process.

    2. Choose the Deploy link.

  2. Change log level to Trace.

    1. Jump to from Deployment StatusNavigate to Manage Integration Content.

    2. Change the Log Level to Trace.

  3. Copy the host of your Endpoint URL of your deployed integration flow Modeling BasicsDecouple Flows Using JMS.

    1. Select the host token from the URL. The host starts after the two forward slashes, and ends after

    2. Copy this token.

  4. Set {{host}} variable.

    1. Switch to the Postmann app and open your workspace with the ModelingBasics collection.

    2. Open DecoupleProcesingDecoupleFlowsUsingJMS.

    3. Choose the {{host} variable to set your host as variable. With Add new variable.

    4. Enter your host token as Value for the host parameter. Set the Scope to Collection : ModelingBasics.

    5. Choose the Set variable button to finish.

    6. Hover over the {{host}} variable to see if it set correct .

  5. Set Authorization as variable with scope Collection: ModelingBasics.

    1. Choose the collection ModelingBasics. Choose the tab Authorization.

    2. Enter the following data:

      NameEntry
      TypeBasic Auth
      Usernamechoose {{username}} and set as before your username with the role MessagingSend
      Passwordchoose {{password}} and set as before your password

      Flag the Show Password radiobutton to see the variable {{password}}

    3. Now we have set three variables {{host}}, {{username}} and {{password}} with our own values at collection level.

  6. Send a message to your process.

    1. Switch to your POST request DecoupleFlowsUsingJMS. Check out at tab Authorisation that Inherit auth from parent is chosen.

    2. Choose the Send button.

    3. If everything works perfectly, the result is an HTTP status 202 Accepted.

  7. Check out the trace of your integration flow Modeling BasicsDecouple Flows Using JMS.

    1. Jump from your integration flow to MonitorOverviewManage Integration Content and change the log level to Trace, as we done several times before.

    2. Choose Monitor Message Processing.

    3. We have two processes involved in this scenario. The first process (No: 1) sends the data to the JMS queue, while the second process (No: 2) polls the data from the JMS queue. The writing process is fast, while the polling process is slow due to a waiting step of 1 minute.

    4. To examine each process, select the respective Completed link.

    5. Below, is the quick writing process.

    6. You can follow the same pattern to examine the reading process.

Task 5: Examine Other Integration Flow Design Guidelines

Steps

  1. Examine other Integration Flow Design Guidelines.

    1. Following the same approach, you can now explore many other integration flows. However, bear in mind that the usage may differ depending on the package. Therefore, it is essential to read the documentation of the corresponding package beforehand.

Log in to track your progress & complete quizzes