Skip to content

Latest commit

 

History

History
190 lines (114 loc) · 9.43 KB

logic-apps-scenario-edi-send-batch-messages.md

File metadata and controls

190 lines (114 loc) · 9.43 KB
title description keywords author manager editor services documentationcenter ms.assetid ms.service ms.workload ms.tgt_pltfrm ms.devlang ms.topic ms.date ms.author
Batch process EDI messages as a group or collection - Azure Logic Apps | Microsoft Docs
Send EDI messages for batch processing in logic apps
batch, batch process, batch encode
divswa
anneta
logic-apps
logic-apps
na
na
na
article
09/21/2017
LADocs; estfan; divswa

Send X12 messages in batch to trading partners

In business to business (B2B) scenarios, partners often exchange messages in groups or batches. To send messages in groups or batches to trading partners, you can create a batch with multiple items and then use the X12 batch action to process those items as a batch.

Batching for X12 messages, like other messages, uses a batch trigger and action. Also for X12, the batch goes through an X12 Encode step before going to the partner or any other destination. For more information about the batch trigger and action, see Batch process messages.

This topic shows you how you can process X12 messages as a batch by performing these tasks:

Prerequisites

To follow this example, you need these items:

Create a logic app that receives X12 messages and creates a batch

Before you can send messages to a batch, you must first create a "receiver" logic app with the Batch trigger. That way, you can select this receiver logic app when you create the sender logic app. For the receiver, you specify the batch name, release criteria, X12 agreement, and other settings.

  1. In the Azure portal, create a logic app with this name: "BatchX12Messages".

  2. In Logic Apps Designer, add the Batch trigger, which starts your logic app workflow. In the search box, enter "batch" as your filter. Select this trigger: Batch – Batch messages

    Add Batch trigger

  3. Provide a name for the batch, and specify criteria for releasing the batch, for example:

    • Batch Name: The name used to identify the batch, which is "TestBatch" in this example.

    • Release Criteria: The batch release criteria, which can be based on the message count, schedule, or both.

      Provide Batch trigger details

    • Message Count: The number of messages to hold as a batch before releasing for processing, which is "5" in this example.

      Provide Batch trigger details

    • Schedule: The batch release schedule for processing, which is "every 10 minutes" in this example.

      Provide Batch trigger details

  4. Add another action that encodes the grouped or batches messages, and creates an X12 batched message.

    a. Choose + New step > Add an action.

    b. In the search box, enter "X12 batch" as your filter and select an action for X12 - Batch Encode. Like the X12 Encode connector, there's multiple variations for batch encoding action. You can select either of them.

    Select X12 Batch Encode action

  5. Set the properties for the action you just added.

    • In the Name of X12 agreement box, select the agreement from the drop-down list. If your list is empty, make sure that you created a connection to your integration account.

    • In the BatchName box, select the Batch Name field from the dynamic content list.

    • In the PartitionName box, select the Partition Name field from the dynamic content list.

    • In the Items box, select the Batched Items from the dynamic content list.

    Batch Encode action Details

  6. For testing purposes, add an HTTP action for sending the batched message to Request Bin service.

    1. Enter "HTTP" as your filter in the search box. Select this action: HTTP - HTTP

      Select HTTP action

    2. From the Method list, select POST. For the Uri box, generate a URI for your request bin and enter that URI. In the Body box, when the dynamic list opens, select the Body field under the Batch encode by agreement name section. If you don't see Body, choose See more next to Batch encode by agreement name.

      Provide HTTP action details

  7. Now that you created a receiver logic app, save your logic app.

    Save your logic app

    [!IMPORTANT] A partition has a limit of 5,000 messages or 80 MB. If either condition is met, the batch might be released, even when the user-defined condition is not met.

Create a logic app that sends X12 messages to a batch

Now create one or more logic apps that send items to the batch defined by the receiver logic app. For the sender, you specify the receiver logic app and batch name, message content, and any other settings. You can optionally provide a unique partition key to divide the batch into subsets to collect items with that key.

Sender logic apps need to know where to send items, while receiver logic apps don't need to know anything about the senders.

  1. Create another logic app with this name: "X12MessageSender". Add this trigger to your logic app: Request / Response - Request

    Add the Request trigger

  2. Add a new step for sending messages to a batch.

    1. Choose + New step > Add an action.

    2. In the search box, enter "batch" as your filter.

  3. Select this action: Send messages to batch – Choose a Logic Apps workflow with batch trigger

    Select "Send messages to batch"

  4. Now select your "BatchX12Messages" logic app that you previously created, which now appears as an action.

    Select "batch receiver" logic app

    [!NOTE] The list also shows any other logic apps that have batch triggers.

  5. Set the batch properties.

    • Batch Name: The batch name defined by the receiver logic app, which is "TestBatch" in this example and is validated at runtime.

      [!IMPORTANT] Make sure that you don't change the batch name, which must match the batch name that's specified by the receiver logic app. Changing the batch name causes the sender logic app to fail.

    • Message Content: The message content that you want to send to the batch

    Set batch properties

  6. Save your logic app. Your sender logic app now looks similar to this example:

    Save your sender logic app

Test your logic apps

To test your batching solution, post X12 messages to your sender logic app from Postman or similar tool. Soon, you should start getting X12 messages, either as a batch of five items or every 10 minutes, in your request bin - all with the same partition key.

Next steps