EDI batch workflows in BizTalk

How to set up an EDI Batch Workflow in BizTalk Server?

Published on : Mar 3, 2023

Category : BizTalk Server

Rajagurunathan Manikandan

Author

Introduction

BizTalk Server is a middleware component that acts as an integration system with message processing capabilities to connect with diverse kinds of systems. It has a magnificent messaging capability with help of efficient components like Orchestration, BRE (Business Rules Engine), BAM (Business Activity Monitoring), EDI, etc. In this blog, we will see about BizTalk Orchestrations and Outgoing EDI Batch messages. We will also see what the in-built EDI orchestration and components are, that support Outgoing EDI Batched messages.

Key Takeaways

  1. You will get to know about BizTalk orchestrations, and how you can create, build and deploy one in BizTalk Server.
  2. Best practices of BizTalk Orchestration in BizTalk Server solutions.
  3. Also, you will get to know about the process of Outgoing EDI Batch Messages, its components, and a Sample walkthrough of EDI Batching configurations in BizTalk360.

Table of Contents

  1. What is EDI?
  2. What is a BizTalk Orchestration?
  3. How do you create orchestration and deploy it in BizTalk Server?
  4. Best practices for using BizTalk Orchestrations in a BizTalk Server solution
  5. How to batch outgoing EDI messages?
  6. Keeping two applications/systems in sync
  7. Conclusion

What is EDI?

Electronic Data Interchange (EDI) is the most common way for business trading partners to exchange data electronically. It supports standard interchange methods like X12, EDIFACT, and some derived methods like HIPPA(derived from X12) and KEDIFACT(derived from EDIFACT). EDI has different entities like Parties, Profiles, Agreements, Protocols, etc. to make the message transmission process simple and secure. To know more about EDI, refer here.

In this blog, we will see how Batching Orchestration in BizTalk EDI application supports Batching in Outgoing EDI messages, but before that, we will see what an Orchestration is, and how we can create, build and deploy one in BizTalk Server.

What is a BizTalk orchestration?

An Orchestration is the executable implementation of a business process, which is a logical and chronological set of activities to achieve a goal. To interact with systems and applications outside the boundaries of the orchestration, you can use send and receive ports. An Orchestration allows the modeling of the business process visually, and it is the primary mechanism to automate the process within a solution. They are created in Visual Studio and compiled into .NET assemblies, deployed in the Global Assembly Cache, and registered in the BizTalk Management database.

Orchestration can be used for,

  1. Correlating multiple messages to fulfill business requirements
  2. Fire business rule into the business rule engine
  3. Manage and scope business transactions
  4. Apply many-to-one mapping

How do you create orchestration and deploy it in the BizTalk Server?

For developing BizTalk Orchestrations, you need to use Visual Studio. Once there, you need to create a BizTalk Server solution, and then follow the below steps.

  1. Creating an Orchestration Project
      1. Create a BizTalk project or use an existing project
      2. Add an Orchestration as New Item in that project
      3. Add Receive Port, Send Port, Receive operation, Send Operation, Scope & Construct shape to perform a simple message transfer

Creating an Orchestration in BizTalk

Fig 1.0 Creating an Orchestration in Visual Studio

2. Build, sign, and GAC (Global Assembly Cache) the orchestration project

      1. Add a signing key for the orchestration project
      2. Build the project and GAC the Orchestration project DLL from the Development prompt

EDI batch workflows in BizTalk

Fig 1.1 Building, GACing Orchestration project

3. Deploy the Orchestration in BizTalk Server, by adding the Orchestration BizTalk Assembly DLL in your BizTalk Application as a BizTalk Resource.

4. Bind the orchestration with a receive port and send port, and start the orchestration to process the message when a message is received via a BizTalk receive port.

Deploying Orchestration in BizTalk server

Fig 1.2 Deploying Orchestration in BizTalk server & Binding Orchestration with Receive, Send Ports

Best practices for using orchestrations in BizTalk Server solutions

  1. Best practices for Building Orchestration
      1. Use actual schema which satisfies Message Body in Orchestrations instead of using basic .NET types like XML.
      2. Use filters in Orchestration Receive to filter only required messages to process in Orchestration.
      3. Add separate scope for segregating the orchestration based on Business process logic.
      4. Add exception handlers for a scope in Orchestration to handle error events.
      5. Create separate orchestrations for independent and high-processing business logic instead of bundling all business process logic in one orchestration.
      6. Use meaningful names (business logic-related names) for all orchestration identifiers.

How to batch Outgoing EDI Messages?

So far, we’ve seen BizTalk orchestration and its creation process. In this section, we’ll see how in-built EDI batch orchestration performs EDI Batching.

1. Batching Outgoing EDI Messages

BizTalk Server will batch EDI transaction sets if batching has been enabled for the agreement associated with the business partner that will be receiving it.

Batch EDI messages in BizTalk

When BizTalk Server is configured to batch an outgoing message, BizTalk Server components will perform the following series of steps to prepare the batched message for sending. This series of steps describes the case in which the EDIReceive pipeline with the BatchMarker pipeline component processes the received interchanges that contain transaction sets to be batched for sending.

    • When a message gets picked up by the adapter in Receive port, it will pass the message to the EDI Receive pipeline.
    • The BatchMarker pipeline component in the EDIReceive pipeline determines which messages need to be batched from the EDI batch filter settings in the party properties (this is the only batching component that looks at the batch filter settings and acts upon them).
      • If the filter settings of only one batch configuration subscribe to a message, the BatchMarker component will promote the property EDI.ToBeBatched = True. This ensures that the batching orchestration will pick up the message.
      • If the filter settings of more than one batch configuration match the context of a message, the BatchMarker component promotes the properties EDI.ToBeRouted = True and sets the EDI.BatchIds property to a space-delimited list containing the matching batch IDs. This ensures that the routing orchestration will subscribe to the message.
    • The Routing orchestration picks up any transaction set for which EDI.ToBeRouted = True and EDI.BatchIds are promoted, and then create copies of the transaction set, ensuring that there is a copy for each batch ID contained in EDI.BatchIds. The routing orchestration sets EDI.ToBeBatched = True and EDI.BatchId is set to the batch ID of the matching batch configuration for each copy of the transaction set. This ensures that the transaction sets will be picked up by the batching orchestration for batching.
    • The Batching orchestration picks up all messages for which the following properties have been promoted:
            • EDI.ToBeBatched = True and EDI.BatchId = the batch id of the batch associated with this instance of the batching orchestration.
            • EDI.ToBeBatched = True and EDI.BatchName = the name of the configured batch and EDI.DestinationPartyName = the party name that contains the batch configuration.
        • When the incoming messages are processed by the EDIReceive pipeline (with the BatchMarker pipeline component), the batching orchestration will batch only X12- or EDIFACT-encoded transaction sets.
        • The batching orchestration validates each transaction set to be batched. If the transaction set fails validation, it sets the EDI.BatchItemValidationFailure context property to “True”. The BatchSuspend orchestration picks up the message based upon that context property, posts error information, and then is suspended.
        • If validation is successful, the batching orchestration assembles the batch elements into a batch and creates an envelope once release criteria have been met.
        • After the batching orchestration completes batching an interchange, it promotes the following properties on that interchange:
            • EDI.DestinationPartyName = %PartyName%
            • EDI.BatchEncodingType = X12 or EDIFACT, and EDI.ToBeBatched = False.
    • A Send port picks up the batched transaction sets based on
        • EDI.DestinationPartyName = <PartyName>
        • EDI.BatchEncodingType = EDIFACT or X12, and EDI.ToBeBatched = False.

and drops the message in the destination location based on the send adapter configuration

2. Configuring Outgoing EDI Batch

To define the way that BizTalk Server batches transaction sets into an EDI interchange, you must create one or more batch configurations for an agreement. All interchanges that BizTalk Server associates with that agreement and that meet the filter criteria for a batch will be batched and released according to the same release criteria for that batch configuration.

Batch configuration consists of a batch name, batch ID, filter definition, group definition, batch release criteria, and batch activation criteria. All properties and options related to batches are available on the Batch Configuration page of the one-way agreement tab in the Agreement Properties dialog box.

Configuration steps:

    • Create an X12 encoding agreement as described in Configuring General Settings (X12). To update an existing agreement, right-click the agreement on the Parties and Business Profiles page and click Properties.
    • On a one-way agreement tab, under the Interchange Settings section, click Batching Configuration.
    • From the Batch Configuration page click New Batch to create a new batch configuration. A Batch1 tab is added.
    • In the Identification section of the tab perform the following steps:
        • Enter the Batch name. This value is used as the tab identifier for this batch configuration.
        • Enter a description of this batch configuration in the Batch description.
        • Batch ID is a read-only text box that displays a unique batch ID after you apply the settings for the batch.
        • Orchestration instance ID is a read-only text box that displays the batching orchestration instance ID that the batch is associated with. An orchestration instance ID is displayed after a batch is started.
    • In the Filter section,
          • Click Filter
          • In the Batch Filter Window, enter the property name, value & group condition these filters will act as subscribers for routing Orchestrations
    • In the Release section, Select any one of the release types
          • Schedule – To schedule the frequent release of Hourly, Daily & Weekly
          • Maximum number of transactions set in – Select Group or Interchange and enter count to release the batch messages whenever threshold count match with Messages counts in MessageBox
          • Maximum number of characters in an interchange – To release batch when an interchange has configured a maximum number of characters
          • External release trigger – whenever an external trigger is executed by an application external to the BizTalk Server.
    • In the Termination section, Select No end Date or End After or End by to terminate the Batch accordingly.

Click Apply to apply Batch Configuration changes & Click Start to start the Batch.

3. Walkthrough of Outgoing EDI Batching

Configuring and Testing the Walkthrough,

The procedures required for this solution include the following:

    • Add the required message schema(s) to a BizTalk project, and then build and deploy the project, making the schema(s) available for use by BizTalk Server in processing the messages.
    • Update the polling interval for the SQL adapter in the BatchControlMessageReccvLoc receive location, so that the batching orchestration will be promptly activated when you click the Start button to send the control message that will activate a batching orchestration instance.
    • Create a receive port for BizTalk Server to receive the EDI X12-encoded .txt input messages from a party.
    • Create a party (trading partner) for both Party A and Party B.
    • Create a business profile for both trading partners.
    • Create an agreement between the two profiles by configuring the EDI properties for the message to be received. Configure the EDI properties for the batched message to be sent. For this solution, configure the agreements such that BizTalk Server will send a batch to Party B whenever two interchanges are received.
    • Create a send port for BizTalk Server to send the batched EDI interchange to the trading partner. This send port will be a static one-way send port.
    • Associate the send port with the agreement that processes the interchanges and batches them.
    • Drop two test EDI interchanges into the local folder associated with the receive location and verify that BizTalk Server has dropped a batched interchange into the folder associated with the send port.

Creating EDI Outgoing Batch Receive

Fig 2.0 Creating EDI Outgoing Batch Receive & Send ports

EDI batch workflows in BizTalk

Fig 2.1 Creating Parties, Agreement & Configuring Batch in BizTalk360

Keeping two applications/systems in sync

  1. EDI message processing is very useful in receiving, processing, and sending messages between two parties in a secure and efficient manner.
  2. EDI process messages and send acknowledgments (if configured) to integration systems, so the business transactions will be in sync within the integration environment.
  3. EDI is used in diverse sectors like Automotive, High Tech, Retail, and Financial industries with relevant EDI protocols (X1, EDIFACT, AS2).

Conclusion

In this article, we’ve discussed what a BizTalk orchestration is and how a Batching Orchestration works in the event of Outgoing EDI Batching. We also found how to create EDI Parties, and Agreements and configure Batch configuration in BizTalk360 to perform an EDI outgoing Batching in the BizTalk Server.

Use BizTalk360 to efficiently Administer, Monitor and Analyse your BizTalk environments.

Reach out to our team for a demo or free trial.