Skip to content

Integration EventBridge Extension

aryehcitron@gmail.com edited this page May 24, 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: Kronikol.Extensions.EventBridge
Namespace: Kronikol.Extensions.EventBridge
Since: v2.20.0

Using a shared library or abstraction layer? If your code doesn't use the EventBridge SDK directly — e.g. it goes through a shared event-routing library, wrapper, or custom abstraction — this extension won't be able to intercept the underlying calls. See Tracking Custom Dependencies for alternative approaches including MessageTracker and TrackingProxy<T>.

Quick Start

using Amazon.EventBridge;
using Kronikol.Extensions.EventBridge;

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

config.WithTestTracking(new EventBridgeTrackingMessageHandlerOptions
{
    CurrentTestInfoFetcher = CurrentTestInfo.Fetcher
});

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",
    CallerName = "OrderService",
    Verbosity = EventBridgeTrackingVerbosity.Detailed,
    CurrentTestInfoFetcher = CurrentTestInfo.Fetcher
};

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 = CurrentTestInfo.Fetcher;
            });
        });
    }
}

Configuration Reference

EventBridgeTrackingMessageHandlerOptions

Property Type Default Description
ServiceName string "EventBridge" Name shown in diagrams for the EventBridge service
CallerName 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
HttpContextAccessor IHttpContextAccessor? null Optional — enables dual-resolution of test identity from HTTP headers. Auto-resolved by DI extensions (v2.26.3+). See HTTP Tracking Setup#Dual-Resolution Test Identity (v2.23.0+)
ExcludedOperations HashSet<EventBridgeOperation> Tag + ListEventBuses ops Operations to skip logging
ExcludedHeaders HashSet<string> AWS auth/SDK headers Headers to omit from logs
SetupVerbosity EventBridgeTrackingVerbosity? null Verbosity override for the Setup phase. See Phase-Aware Tracking
ActionVerbosity EventBridgeTrackingVerbosity? null Verbosity override for the Action phase. See Phase-Aware Tracking
TrackDuringSetup bool true When false, tracking is suppressed during Setup. See Phase-Aware Tracking
TrackDuringAction bool true When false, tracking is suppressed during Action. See Phase-Aware Tracking

v2.23.0+ Dual-Resolution: EventBridgeTrackingMessageHandler accepts an optional IHttpContextAccessor? httpContextAccessor constructor parameter for resolving test identity from HTTP request headers when running inside the SUT's request pipeline. v2.26.3+: Set HttpContextAccessor on EventBridgeTrackingMessageHandlerOptions instead — the tracker reads it automatically. See HTTP Tracking Setup#Dual-Resolution Test Identity (v2.23.0+) for details.

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