All Products
Search
Document Center

EventBridge:Overview

最終更新日:Jun 28, 2024

An event is a data record of status changes. This topic describes the details of event parameters in EventBridge.

Event sources can publish only events that comply with the CloudEvents specification to EventBridge. For more information about the CloudEvents specification, see CloudEvents 1.0.

The following sample code provides an example of an event that an event source publishes to EventBridge:

{
    "data":{
        "meetingName":"swqd",
        "groupId":"456",
        "action":"camera_off",
        "time":1590592527490,
        "userId":"199525",
        "meetingUUID":"hz-20864c8f-b10d-45cd-9935-884bca1b****"
    },
    "id":"45ef4dewdwe1-7c35-447a-bd93-fab****",
    "source":"acs:aliyuncvc",
    "specversion":"1.0",
    "subject":"acs.aliyuncvc:cn-hangzhou:{AccountId}:215672",
    "time":"2020-11-19T21:04:41+08:00",
    "type":"aliyuncvc:MeetingEvent:MemberOperate",
    "aliyunaccountid":"123456789098****",
    "aliyunpublishtime":"2020-11-19T21:04:42.179PRC",
    "aliyuneventbusname":"default",
    "aliyunregionid":"cn-hangzhou",
    "aliyunpublishaddr":"172.25.XX.XX"
}

The following table describes the parameters in the preceding event.

Parameter

Type

Required

Example

Description

id

String

Yes

45ef4dewdwe1-7c35-447a-bd93-fab****

The event ID. The ID is the unique identifier of an event. Producers must ensure that the values of the source and id parameters are unique for each event. If the event is re-sent due to exceptions such as network errors, two events that have the same id value may be received. Receivers consider events in which the values of the source and id parameters are identical as duplicated events. When an event is routed to and processed by an event target, the system uses the ID to track the event.

source

String

Yes

acs:aliyuncvc

The event source, which is the service that produces the event and identifies the context in which the event occurs. The value of this parameter includes information such as the type of the event source and the publishing mechanism or producing process of the event. Producers must ensure that the values of the source and id parameters are unique for each event.

specversion

String

Yes

1.0

The version of the CloudEvents specification.

type

String

Yes

aliyuncvc:MeetingEvent:MemberOperate

The event type. This parameter is related to the event source. This parameter is used to route events, query events, and implement policies. The format of this parameter is defined by the producer and includes information such as the version number.

datacontenttype

String

No

application/json;charset=utf-8

The content type of the data parameter. Only the application/json content type is supported.

dataschema

URI

No

None

The format of the data parameter.

subject

String

No

acs.aliyuncvc:cn-hangzhou:{AccountId}:215672

The event subject. JSON data contains Alibaba Cloud Resource Names (ARNs) that identify the resources that are involved in the event. In the publish-subscribe model, a subscriber subscribes to events from an event source. However, if the source parameter contains a sub-structure, the source parameter alone is insufficient to identify the event. If the data content cannot be interpreted, the subject parameter can be used to identify the subject of the event in subscription filtering scenarios.

time

Timestamp

No

2020-11-19T21:04:41+08:00

The time when the event occurred. If the event occurred at an unknown time, the producer of the event in the CloudEvents format can set the time parameter to another value such as the current time. However, all producers of the same source must set the source parameter to the same value.

data

Struct

No

{
    "meetingName":"swqd",
    "groupId":"456",
    "action":"camera_off",
    "time":1590592527490,
    "userId":"199525",
    "meetingUUID":"hz-20864c8f-b10d-45cd-9935-884bca1b****"
}

The event content. The value is a JSON object, which is determined by the event source that produces the event. CloudEvents may contain the context given by the event producer when the event occurs. This information is encapsulated in the data parameter.

aliyunaccountid

String

No

123456789098****

The ID of the Alibaba Cloud account. This parameter is not defined in the CloudEvents specification and is added to an event after an event source publishes the event to EventBridge.

aliyunpublishtime

Timestamp

No

2020-11-19T21:04:42.179PRC

The time when the event was received. This parameter is not defined in the CloudEvents specification and is added to an event after an event source publishes the event to EventBridge.

aliyuneventbusname

String

Yes

default

The name of the event bus that receives the event. This parameter is not defined in the CloudEvents specification and is added to an event after an event source publishes the event to EventBridge.

aliyunregionid

String

No

cn-hangzhou

The region where the event was received. This parameter is not defined in the CloudEvents specification and is added to an event after an event source publishes the event to EventBridge.

aliyunpublishaddr

String

No

172.25.XX.XX

The IP address of the server that receives the event. This parameter is not defined in the CloudEvents specification and is added to an event after an event source publishes the event to EventBridge.

Events that event sources publish to EventBridge are divided into the following types:

  • Alibaba Cloud service events

    Alibaba Cloud services automatically connect to EventBridge as event sources. For information about the types of Alibaba Cloud service events that are supported by EventBridge, see Alibaba Cloud service event sources.

  • Custom application events

    If you use your application as an event source, you must connect your application to EventBridge by using an SDK.