ALIYUN::EventBridge::Rule

更新时间:
复制 MD 格式

ALIYUN::EventBridge::Rule creates an event rule for a specified event bus.

Syntax

{
  "Type": "ALIYUN::EventBridge::Rule",
  "Properties": {
    "Status": String,
    "EventBusName": String,
    "FilterPattern": Map,
    "Description": String,
    "Targets": List,
    "RuleName": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

EventBusName

String

Yes

No

The name of the event bus.

For more information, refer to Limits.

FilterPattern

Map

Yes

Yes

The event pattern.

Must be in JSON format. Valid values:

  • stringEqual pattern

  • stringExpression pattern

Note

You can have up to 5 event patterns.

Targets

List

Yes

Yes

The event delivery targets.

For more information, refer to Targets properties.

RuleName

String

Yes

No

The name of the event rule.

For more information, refer to Limits.

Status

String

No

Yes

The status of the rule.

Valid values:

  • ENABLE (default)

  • DISABLE

Description

String

No

Yes

The description of the rule.

None

Targets syntax

"Targets": [
  {
    "PushRetryStrategy": String,
    "Type": String,
    "Endpoint": String,
    "Id": String,
    "ParamList": List,
    "DeadLetterQueue": Map,
    "ConcurrentConfig": Map,
    "ErrorsTolerance": String
  }
]

Targets properties

Property

Type

Required

Editable

Description

Constraint

Endpoint

String

Yes

No

The endpoint of the event target.

None

Id

String

Yes

No

The custom ID of the target.

None

ParamList

List

Yes

No

The parameters passed with events.

For more information, refer to ParamList properties.

Type

String

Yes

No

The type of the target.

None

PushRetryStrategy

String

No

No

The event delivery retry policy.

Valid values:

  • BACKOFF_RETRY: Retries failed events up to 3 times at random intervals of 10–20 seconds.

  • EXPONENTIAL_DECAY_RETRY: Retries failed events up to 176 times. Intervals increase exponentially to a maximum of 512 seconds. Total retry window: 1 day.

    Retry intervals (seconds): 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 (repeated 167 times).

DeadLetterQueue

Map

No

No

The dead-letter queue configuration.

Unprocessed events or events exceeding max retries are written to the dead-letter queue.

Supported queue types: Alibaba Cloud RocketMQ, Simple Message Queue, ApsaraMQ for Kafka and EventBridge. For more information, refer to DeadLetterQueue properties.

ConcurrentConfig

Map

No

No

The concurrency configuration.

For more information, refer to ConcurrentConfig properties.

ErrorsTolerance

String

No

No

The error tolerance policy.

Valid values:

  • ALL: Allows error tolerance. Errors do not block event processing. Events exceeding max retries are sent to a dead-letter queue or discarded based on your configuration.

  • NONE: No error tolerance. Events that fail after max retries block event processing.

DeadLetterQueue syntax

"DeadLetterQueue": 
  {
    "Arn": String
  }

DeadLetterQueue properties

Property

Type

Required

Editable

Description

Constraint

Arn

String

Yes

No

The Alibaba Cloud Resource Name (ARN) of the dead-letter queue.

Unprocessed events or events exceeding max retries are written to the dead-letter queue.

Supported queue types: Alibaba Cloud RocketMQ and Simple Message Queue.

ConcurrentConfig syntax

"ConcurrentConfig": 
  {
    "Concurrency": Integer
  }

ConcurrentConfig properties

Property

Type

Required

Editable

Description

Constraint

Concurrency

Integer

Yes

No

The number of concurrent connections.

None

ParamList syntax

"ParamList": [
  {
    "Form": String,
    "Value": String,
    "ResourceKey": String,
    "Template": String
  }
]

ParamList properties

Property

Type

Required

Editable

Description

Constraint

Form

String

Yes

No

The form of the event transformation.

For more information, refer to Event target parameters.

ResourceKey

String

Yes

No

The resource key of the event transformation.

For more information, refer to Event target parameters.

Value

String

Yes

No

The value of the event transformation.

None

Template

String

No

No

The template style.

None

Response parameters

Fn::GetAtt

  • EventBusName: the name of the event bus.

  • RuleARN: the ARN of the event rule, used for authorization.

  • RuleName: the name of the event rule.

Example

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  EventBusName:
    Type: String
    Description: The name of the event bus.
  Targets:
    Type: Json
    Description: The event target to which events are delivered.
    MinLength: 1
    MaxLength: 5
  RuleName:
    Type: String
    Description: The name of the event rule.
  FilterPattern:
    Required: true
    Type: Json
    Description:
      en: The event pattern, in the JSON format.
    Label:
      zh-cn: event pattern
      en: FilterPattern
Resources:
  Rule:
    Type: ALIYUN::EventBridge::Rule
    Properties:
      FilterPattern:
        Ref: FilterPattern
      EventBusName:
        Ref: EventBusName
      Targets:
        Ref: Targets
      RuleName:
        Ref: RuleName
Outputs:
  EventBusName:
    Description: The name of the event bus.
    Value:
      Fn::GetAtt:
        - Rule
        - EventBusName
  RuleARN:
    Description: The Alibaba Cloud Resource Name (ARN) of the event rule. The ARN is used for authorization.
    Value:
      Fn::GetAtt:
        - Rule
        - RuleARN
  RuleName:
    Description: The name of the event rule.
    Value:
      Fn::GetAtt:
        - Rule
        - RuleName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "EventBusName": {
      "Type": "String",
      "Description": "The name of the event bus."
    },
    "Targets": {
      "Type": "Json",
      "Description": "The event target to which events are delivered.",
      "MinLength": 1,
      "MaxLength": 5
    },
    "RuleName": {
      "Type": "String",
      "Description": "The name of the event rule."
    },
    "FilterPattern": {
      "Required": true,
      "Type": "Json",
      "Description": {
        "en": "The event pattern, in the JSON format."
      },
      "Label": {
        "zh-cn": "event pattern",
        "en": "FilterPattern"
      }
    }
  },
  "Resources": {
    "Rule": {
      "Type": "ALIYUN::EventBridge::Rule",
      "Properties": {
        "FilterPattern": {
          "Ref": "FilterPattern"
        },
        "EventBusName": {
          "Ref": "EventBusName"
        },
        "Targets": {
          "Ref": "Targets"
        },
        "RuleName": {
          "Ref": "RuleName"
        }
      }
    }
  },
  "Outputs": {
    "EventBusName": {
      "Description": "The name of the event bus.",
      "Value": {
        "Fn::GetAtt": [
          "Rule",
          "EventBusName"
        ]
      }
    },
    "RuleARN": {
      "Description": "The Alibaba Cloud Resource Name (ARN) of the event rule. The ARN is used for authorization.",
      "Value": {
        "Fn::GetAtt": [
          "Rule",
          "RuleARN"
        ]
      }
    },
    "RuleName": {
      "Description": "The name of the event rule.",
      "Value": {
        "Fn::GetAtt": [
          "Rule",
          "RuleName"
        ]
      }
    }
  }
}