Use an event bus as the event source for an event stream

更新时间:
复制 MD 格式

An event bus collects events from multiple sources and routes them to targets based on rules. When you need to filter, transform, or deliver events from a bus through a lightweight pipeline instead of full event rules, configure the event bus as the source of an event stream. The event stream forwards matched events for processing and delivery to a downstream target.

The default event bus automatically receives events from Alibaba Cloud services. Use a custom event bus if your events come from a custom application.

Prerequisites

Before you begin, make sure that you have:

Create the event stream

  1. Log on to the EventBridge console. In the left-side navigation pane, click Event Streams.

  2. In the top navigation bar, select a region and click Create Event Stream.

  3. In the top navigation bar, select a region and click Create Event Stream.

  4. In the Create Event Stream panel, enter a Task Name and Description, then complete the following configuration sections.

    • Configure the event source

      1. In the Source configuration wizard, set Data Provider to Event Bus and configure the following parameters.

        Parameter

        Description

        Example

        Region

        Select the destination region.

        China (Hangzhou)

        Name

        Select the destination event bus. Select default for Alibaba Cloud service events, or select a custom event bus for application events.

        default

        Subscription Rule

        How the event stream subscribes to the bus. Quickly Create Rule (recommended) auto-generates a rule named EVENTSTREAMING_xxxx. Use Existing Rule lets you select a rule you already created.

        Quickly Create Rule

        Messages

        Maximum number of messages that can be sent in a batch for a function call. A request is sent only when the number of backlogged messages reaches the specified value. Valid values: 1 to 10,000.

        100

        Interval (Unit: Seconds)

        The interval at which the function is called. The system aggregates messages and sends them to Function Compute at the specified interval. Valid values: 0 to 15. Set to 0 for immediate delivery with no waiting.

        3

      2. Click Next Step.

      3. In the Filtering, Transformation, and Sink steps, configure the event filtering and transformation rules and the event target.

    • Configure retry and dead-letter policies

      Set the retry policy and dead-letter queue for the event stream. These policies control how EventBridge handles delivery failures.

  5. Click Save.

Event example

Events delivered through the bus follow the CloudEvents specification. A typical event looks like this:

{
    "id": "ae3gchfi-4b4d-927d-fbj9-516ib2******",
    "type": "ui:Created:PostObject",
    "dataschema": "http://taobao.com/item.json",
    "subject": "my:subject",
    "data": {
        "name": "Eventbridge",
        "number": 100
    }
}

The top-level fields (id, type, dataschema, subject) are standard CloudEvents attributes. For definitions, see Event overview.

The data field carries the event payload. Its contents depend on the event source:

Parameter

Type

Example

Description

name

String

Eventbridge

Identifier for business logic, such as a module name or event source label.

number

Number

100

Numeric value associated with the event, such as a count, version number, or status code.

What's next