Managing AWS B2B Data Interchange events using Amazon EventBridge - AWS B2B Data Interchange

Managing AWS B2B Data Interchange events using Amazon EventBridge

Amazon EventBridge is a serverless service that uses events to connect application components together, making it easier for you to build scalable event-driven applications. Event-driven architecture is a style of building loosely-coupled software systems that work together by emitting and responding to events. Events represent an operation that succeeds or fails.

As with many AWS services, AWS B2B Data Interchange generates and sends events to the EventBridge default event bus, which is automatically provisioned in every AWS account. An event bus is a router that receives events and delivers them to zero or more destinations, or targets. Rules you specify for the event bus evaluate events as they arrive. Each rule checks whether an event matches the rule's event pattern. If the event does match, the event bus sends the event to the specified target(s).

AWS services send events to the EventBridge default event bus. If the event matches a rule's event pattern, EventBridge sends the event to the targets specified for that rule.

AWS B2B Data Interchange events

AWS B2B Data Interchange sends events to the default EventBridge event bus automatically. You can create rules on the event bus; each rule includes an event pattern and one or more targets. Events that match a rule's event pattern are delivered to the specified targets on a best effort basis. Events might be delivered out of order.

The following events are generated by AWS B2B Data Interchange. For more information, see EventBridge events in the Amazon EventBridge User Guide.

AWS B2B Data Interchange emits the following events to EventBridge.

Event detail type Description

Transformation Completed

A transformation has completed successfully.

Transformation Failed

An attempted transformation has failed.

Acknowledgement Completed An Acknowledgement was generated and written to Amazon S3.
Acknowledgement Failed An Acknowledgement either failed to generate or failed to write to Amazon S3.

Sending AWS B2B Data Interchange events using EventBridge rules

To have the EventBridge default event bus send AWS B2B Data Interchange events to a target, you must create a rule that contains an event pattern that matches the data in the desired AWS B2B Data Interchange events.

Creating a rule consists of the following general steps:

  1. Creating an event pattern for the rule that specifies:

    • AWS B2B Data Interchange is the source of events being evaluated by the rule.

    • (Optional): Any other event data to match against.

    For more information, see Creating event patterns for AWS B2B Data Interchange events

  2. (Optional): Creating an input transformer that customizes the data from the event before EventBridge passes the information to the target of the rule.

    For more information, see Input transformation in the EventBridge User Guide.

  3. Specifying the target(s) to which you want EventBridge to deliver events that match the event pattern.

    Targets can be other AWS services, software-as-a-service (SaaS) applications, API destinations, or other custom endpoints. For more information, see Targets in the EventBridge User Guide.

For comprehensive instructions on creating event bus rules, see Creating rules that react to events in the EventBridge User Guide.

Creating event patterns for AWS B2B Data Interchange events

When AWS B2B Data Interchange delivers an event to the default event bus, EventBridge uses the event pattern defined for each rule to determine if the event should be delivered to the rule's target(s). An event pattern matches the data in the desired AWS B2B Data Interchange events. Each event pattern is a JSON object that contains:

  • A source attribute that identifies the service sending the event. For AWS B2B Data Interchange events, the source is aws.b2bi.

  • (Optional): A detail-type attribute that contains an array of the event types to match.

  • (Optional): A detail attribute containing any other event data on which to match.

For example, the following event pattern matches against all events from AWS B2B Data Interchange:

{ "source": ["aws.b2bi"] }

The following event pattern matches all of the B2B Data Interchange events.

{ "source": ["aws.b2bi"], "detail-type": ["Transformation Completed", "Transformation Failed"] }

The following event pattern matches successful transformations for a trading partner with ID trading-partner-id.

{ "source": ["aws.b2bi"], "detail-type": ["Transformation Completed"], "detail": { "trading-partner-id": [trading-partner-id] } }

For more information on writing event patterns, see Event patterns in the EventBridge User Guide.

Testing event patterns for AWS B2B Data Interchange events in EventBridge

You can use the EventBridge Sandbox to quickly define and test an event pattern, without having to complete the larger process of creating or editing a rule. Using the Sandbox, you can define an event pattern and use a sample event to confirm the pattern matches the desired events. EventBridge give you the option of creating a new rule using that event pattern, directly from the sandbox.

For more information, see Testing an event pattern using the EventBridge Sandbox in the EventBridge User Guide.

Amazon EventBridge permissions

AWS B2B Data Interchange doesn't require any additional permissions to deliver events to Amazon EventBridge.

The targets you specify may need specific permissions or configuration. For more details on using specific services for targets, see Amazon EventBridge targets in the Amazon EventBridge User Guide.

Additional EventBridge resources

Refer to the following topics in the Amazon EventBridge User Guide for more information on how to use EventBridge to process and manage events.

  • For detailed information on how event buses work, see Amazon EventBridge event bus.

  • For information on event structure, see Events.

  • For information on constructing event patterns for EventBridge to use when matching events against rules, see Event patterns.

  • For information on creating rules to specify which events EventBridge processes, see Rules.

  • For information on to specify what services or other destinations EventBridge sends matched events to, see Targets.