Skip to content

Integration EventBridge Extension

Aryeh Citron edited this page Apr 22, 2026 · 10 revisions

Integration: Amazon EventBridge Extension

Track Amazon EventBridge operations in your test diagrams. This extension intercepts PutEvents, rule management, target management, event bus lifecycle, and other EventBridge API calls via the AWS SDK HTTP pipeline.

NuGet Package: TestTrackingDiagrams.Extensions.EventBridge
Namespace: TestTrackingDiagrams.Extensions.EventBridge
Since: v2.20.0

Quick Start

using Amazon.EventBridge;
using TestTrackingDiagrams.Extensions.EventBridge;

var config = new AmazonEventBridgeConfig
{
    RegionEndpoint = RegionEndpoint.USEast1
};

config.WithTestTracking(new EventBridgeTrackingMessageHandlerOptions
{
    CurrentTestInfoFetcher = () => (TestContext.Current.Test.TestDisplayName,
                                    TestContext.Current.Test.UniqueID)
});

var client = new AmazonEventBridgeClient(credentials, config);

How It Works

Amazon EventBridge uses JSON-RPC over HTTP POST — all requests go to the same endpoint with the operation identified by the X-Amz-Target header (e.g. AWSEvents.PutEvents). This is the same pattern used by DynamoDB.

The extension plugs a DelegatingHandler into the AWS SDK's HTTP pipeline via AmazonEventBridgeConfig.HttpClientFactory. Every HTTP request/response is intercepted, classified, and logged to RequestResponseLogger for diagram generation.

This follows the exact same AWS SDK interception pattern as the Integration S3 Extension, Integration DynamoDB Extension, Integration SQS Extension, and Integration SNS Extension extensions.

Setup

Direct Configuration

var config = new AmazonEventBridgeConfig
{
    RegionEndpoint = RegionEndpoint.USEast1
};

var options = new EventBridgeTrackingMessageHandlerOptions
{
    ServiceName = "EventBridge",
    CallingServiceName = "OrderService",
    Verbosity = EventBridgeTrackingVerbosity.Detailed,
    CurrentTestInfoFetcher = () => (TestContext.Current.Test.TestDisplayName,
                                    TestContext.Current.Test.UniqueID)
};

config.WithTestTracking(options);
var client = new AmazonEventBridgeClient(credentials, config);

WebApplicationFactory / DI

public class MyWebAppFactory : WebApplicationFactory<Program>
{
    protected override void ConfigureWebHost(IWebHostBuilder builder)
    {
        builder.ConfigureServices(services =>
        {
            services.PostConfigure<EventBridgeTrackingMessageHandlerOptions>(opts =>
            {
                opts.CurrentTestInfoFetcher = () => (TestContext.Current.Test.TestDisplayName,
                                                     TestContext.Current.Test.UniqueID);
            });
        });
    }
}

Configuration Reference

EventBridgeTrackingMessageHandlerOptions

Property Type Default Description
ServiceName string "EventBridge" Name shown in diagrams for the EventBridge service
CallingServiceName string "Caller" Name shown for the calling service
Verbosity EventBridgeTrackingVerbosity Detailed Level of detail in logged entries
CurrentTestInfoFetcher Func<(string Name, string Id)>? null Required — provides current test context
CurrentStepTypeFetcher Func<string?>? null Optional step type for BDD frameworks
ExcludedOperations HashSet<EventBridgeOperation> Tag + ListEventBuses ops Operations to skip logging
ExcludedHeaders HashSet<string> AWS auth/SDK headers Headers to omit from logs

Default Excluded Operations

  • TagResource, UntagResource, ListTagsForResource — noisy tag management
  • ListEventBuses — infrastructure query with low diagram value

Default Excluded Headers

Authorization, x-amz-date, x-amz-security-token, x-amz-content-sha256, User-Agent, amz-sdk-invocation-id, amz-sdk-request

Verbosity Levels

Raw

Full HTTP details — method is POST, URI is the actual AWS endpoint, all request/response bodies and non-excluded headers logged.

Detailed (default)

Classified labels with contextual detail:

  • PutEvents [OrderCreated] — includes DetailType from first entry
  • PutEvents [OrderCreated] x5 — includes entry count when > 1
  • PutEvents x3 — entry count without DetailType
  • PutRule my-rule — includes rule name
  • DeleteRule old-rule
  • CreateEventBus orders-bus — includes bus name
  • Other operations: enum name (e.g. ListRules, StartReplay)

URI: eventbridge://{busName}/ (defaults to eventbridge://default/ when no bus name)

Summarised

Grouped, minimal labels:

  • PutEvents
  • ManageRule (PutRule, DeleteRule)
  • ManageTargets (PutTargets, RemoveTargets)
  • ManageBus (CreateEventBus, DeleteEventBus)
  • Other: enum name

No request/response bodies or headers logged. Other operations are skipped entirely.

Supported Operations

The classifier recognises 28 EventBridge API operations via X-Amz-Target:

Category Operations
Events PutEvents, PutPartnerEvents, TestEventPattern
Rules PutRule, DeleteRule, DescribeRule, EnableRule, DisableRule, ListRules
Targets PutTargets, RemoveTargets, ListTargetsByRule
Event Buses CreateEventBus, DeleteEventBus, DescribeEventBus, ListEventBuses
Archives CreateArchive, DeleteArchive, DescribeArchive, ListArchives
Replays StartReplay, DescribeReplay, ListReplays
Connections CreateApiDestination, CreateConnection
Tags TagResource, UntagResource, ListTagsForResource

Unrecognised targets map to EventBridgeOperation.Other.

Body Parsing

For PutEvents, the classifier parses the JSON body to extract:

  • EventBusName — from top-level or first entry
  • DetailType — from first entry (e.g. "OrderCreated")
  • Source — from first entry (e.g. "my.service")
  • EntryCount — number of entries in the batch (max 10 per API call)

For PutRule, DeleteRule, DescribeRule, it extracts:

  • NameRuleName
  • EventBusName

Body parsing is best-effort — malformed JSON is silently ignored.

ITrackingComponent

EventBridgeTrackingMessageHandler implements ITrackingComponent and auto-registers with TrackingComponentRegistry in its constructor. This enables unused-component diagnostic warnings (passive, since v2.3.0).

Scope

This extension covers the Amazon EventBridge service (AWSSDK.EventBridge). The following are separate AWS services with their own SDK clients and are not covered:

  • EventBridge Pipes (AWSSDK.Pipes)
  • EventBridge Scheduler (AWSSDK.Scheduler)

See Also

Home


Demo


Getting Started

Common Tasks

Integration Guides

Extensions

Configuration

Features

Reference

Clone this wiki locally