Introducing a new way to review your PRs.

Read the announcement

floci-io / floci

Light, fluffy, and always free - The AWS Local Emulator alternative

View on GitHub

38 documents · Updated Nov 23, 2026

docs / svc-eventbridge-v2

EventBridge V2 event delivery

EventBridge V2 provides a separate event bus and subscriber model for publishing events and delivering matching events to Amazon SQS queues. Its AWS-compatible APIs manage the bus and subscriber lifecycles, apply filters before delivery, and report the result of each published entry.

Service boundary

EventBridge V2 is a separate service model from standard EventBridge. It uses the Smithy RPC v2 CBOR API at POST /service/AWSEventsV2/operation/<Operation> and uses distinct event-busv2 and subscriber resources, even though both services use the events signing name. For standard EventBridge rules, targets, schedules, and Step Functions links, see EventBridge and Step Functions.

The API exposes these resource and event operations:

  • CreateEventBus, DescribeEventBus, ListEventBuses, and DeleteEventBus
  • CreateSubscriber, DescribeSubscriber, ListSubscribers, UpdateSubscriber, and DeleteSubscriber
  • PutEvents

Unsupported operations return UnsupportedOperation.

References: src/…/EventBridgeV2Handler.java• L21-57 src/…/EventBridgeV2IntegrationTest.java• L172-184

Resource model

An event bus is the named container for published events. A subscriber belongs to one bus and defines how matching events reach one SQS queue in the same account. The bus and subscriber have separate ARNs, names, state, timestamps, and list and describe operations.

ResourcePurposeMain relationship
Event busAccepts published events and assigns sequence numbersOwns subscribers and must be empty before deletion
SubscriberSelects events and sends them to a queueBelongs to one bus and has a fixed target queue

Bus creation is idempotent when a repeated request uses the same ClientToken and the same values. A different request with that token fails. Subscriber creation follows the same rule. A bus is created in ACTIVE state, while a subscriber is RUNNING unless the request sets it to STOPPED.

This diagram shows the ownership path from an account to a bus, then from the bus to its subscribers and queue targets.

flowchart LR
    Account[Account and Region] --> Bus[Event bus]
    Bus --> Subscriber[Subscriber]
    Subscriber --> Queue[Amazon SQS queue]
    Bus --> Publish[PutEvents]
    Publish --> Subscriber

Deleting a subscriber removes its delivery path. Deleting its bus is allowed only after all subscribers are deleted. Bus and subscriber list operations are paged and can filter by name prefix; subscriber listing can also be limited to one bus.

References: src/…/EventBridgeV2Service.java• L108-212 src/…/EventBridgeV2Service.java• L214-358 src/…/EventBridgeV2Handler.java• L61-184

Published event model

PutEvents publishes one or more entries to a named bus. Each accepted entry receives an EventBridge envelope with source, detail type, account, Region, event time, detail, event ID, and a bus sequence number. The response reports success or failure for each entry, so one malformed entry does not reject the other valid entries in the same request.

The Detail value is parsed as a JSON object. An omitted or null detail becomes an empty object. A detail that is not valid JSON or is not an object returns MalformedDetail for that entry and is not sent to subscribers. The bus does not retain events for later replay, even when a storage retention setting is supplied.

This flow shows how a publish request becomes an envelope, a per-entry result, and zero or more subscriber deliveries.

flowchart LR
    Entry[PutEvents entry] --> Validate[Validate source, type, time, and detail]
    Validate --> Result[Per-entry publish result]
    Validate --> Envelope[EventBridge envelope and system metadata]
    Envelope --> Match[Match subscriber filters]
    Match -->|match and RUNNING| Delivery[Queue delivery]
    Match -->|no match or STOPPED| Skip[No delivery]

Accepted events are queued for delivery in bus sequence order. Concurrent publish requests still produce an ordered delivery stream for the bus. The published event remains available only during this delivery path; StartingPosition, PointInTimeConfiguration, and ResumePosition do not provide replay of older events.

References: src/…/EventBridgeV2Service.java• L372-489 src/…/EventBridgeV2Service.java• L640-668 src/…/EventBridgeV2ServiceTest.java• L523-624

Subscriber filtering

A subscriber without a filter receives every accepted event on its bus. A configured subscriber can have one EventBridge pattern for each filter scope, and an event must match every configured scope before delivery starts.

Filter scopes

The filter scope selects the part of the published event that a pattern examines:

ScopeEvent view
DATAThe EventBridge envelope, including the published detail under detail
METADATAProducer metadata; PutEvents does not supply this view
SYSTEM_METADATAService fields such as event ID, source, detail type, ingestion time, delivery type, and sequence number

Patterns support exact values and the supported EventBridge comparison forms, including prefix, suffix, case-insensitive equality, numeric comparison, existence, anything-but, and $or. Wildcard matchers and patterns that the service cannot evaluate are rejected when the subscriber is created or updated. A pattern that names a missing event field matches no event.

References: src/…/SubscriberFilters.java• L14-18 src/…/SubscriberFilters.java• L38-97 src/…/SubscriberFilters.java• L108-169 src/…/EventBridgeV2SubscriberIntegrationTest.java• L42-70

Delivery lifecycle

After filtering, EventBridge V2 sends one message for each matching event to the subscriber's SQS queue. The subscriber must name an SQS target in the caller's account. The role ARN is checked as a request value but is not assumed for the local delivery.

Message forms

The transformer controls the message body:

  • RAW, or no transformer, sends the event envelope as the body.
  • WITH_METADATA sends Data, Metadata, and SystemMetadata together.
  • JSONATA is not evaluated and is rejected.

SQS message group IDs, deduplication IDs, delays, and message attributes can use literal values or supported paths into the event. This lets a subscriber copy values such as an event group ID or event ID into the queue request without changing the event body.

References: src/…/EventBridgeV2Delivery.java• L19-23 src/…/EventBridgeV2Delivery.java• L38-66 src/…/EventExpressions.java• L11-15 src/…/EventExpressions.java• L30-55 src/…/EventBridgeV2SubscriberIntegrationTest.java• L84-110

Subscriber state

RUNNING subscribers take part in matching and delivery. STOPPED subscribers remain resources that can be described and updated, but they receive no newly published events. Updating a subscriber changes only the settings in the request and keeps omitted settings. Its queue target is part of the subscriber identity: updates can change its invoke parameters, but not its TargetArn.

Delivery is immediate and one message is created per matching event. If the queue delivery fails, the event is logged and dropped. Stored retry, batch, and on-failure settings do not add a retry or dead-letter flow in this service.

References: src/…/EventBridgeV2Service.java• L266-326 src/…/EventBridgeV2Service.java• L399-454 src/…/EventBridgeV2Delivery.java• L38-55 src/…/EventBridgeV2SubscriberIntegrationTest.java• L114-190

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the V2 operation names, CBOR response timestamps, and AWSEventsV2 route aligned between the handler and AWS SDK clients.
  • Keep bus and subscriber ARN shapes aligned with lookup, list, delete, and ownership checks.
  • Keep the published envelope, filter scopes, and system metadata names aligned so filters and delivery expressions see the same event.
  • Keep subscriber update rules aligned with the fixed bus and queue target identity.
  • Keep transformer output and SQS parameter expression paths aligned with the message body and metadata shapes.
  • Keep sequence assignment, concurrent publish ordering, and per-entry PutEvents results consistent.

Important failure modes

TriggerConsequenceGuard
Detail is invalid JSON or is not an objectThat entry returns MalformedDetail and is not deliveredPublish a JSON object as Detail
A subscriber is STOPPEDMatching events are skippedSet the subscriber to RUNNING before publishing
A target is not an SQS queue in the caller's accountSubscriber creation or update returns InvalidInputExceptionUse an SQS queue ARN from the same account
A filter uses a wildcard or unsupported matcherSubscriber creation or update failsUse the supported EventBridge pattern forms
The target queue cannot receive the messageThe event is logged and dropped without retryEnsure the queue exists and accepts the delivery
A bus still has subscribers during deletionDeletion returns ResourceInUseExceptionDelete all subscribers first
A client token is reused with different create valuesThe request returns IdempotentParameterMismatchExceptionReuse a token only for the original request
A caller expects point-in-time or resume deliveryOlder events are not replayedTreat V2 delivery as live-only and publish again when needed

Key files

FileWhy to read it
src/…/EventBridgeV2Handler.javaMaps AWS-compatible V2 operations to request and response shapes
src/…/EventBridgeV2Service.javaDefines bus and subscriber resources, publish results, filtering flow, and ordering
src/…/SubscriberFilters.javaDefines filter scopes, validation, and event matching
src/…/EventBridgeV2Delivery.javaDefines queue message creation and SQS delivery behavior
src/…/EventExpressions.javaDefines the event paths supported in queue parameters
src/…/EventBusV2.javaShows the durable identity and state of a V2 event bus
src/…/SubscriberV2.javaShows the durable identity and delivery settings of a subscriber
src/…/EventBridgeV2SubscriberIntegrationTest.javaDemonstrates end-to-end filtering, queue delivery, updates, and stopped subscribers
src/…/EventBridgeV2IntegrationTest.javaDemonstrates the Smithy RPC v2 CBOR API and bus lifecycle