Skip to content

BusLambdaSubscriber

Reference doc for the `sst.aws.BusLambdaSubscriber` component.

The BusLambdaSubscriber component is internally used by the Bus component to add subscriptions to Amazon EventBridge Event Bus.

You’ll find this component returned by the subscribe method of the Bus component.


Constructor

new BusLambdaSubscriber(name, args, opts?)

Parameters

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.permission

Type Permission

The Lambda permission.

nodes.rule

Type EventRule

The EventBus rule.

nodes.target

Type EventTarget

The EventBus target.

nodes.function

Type Output<Function>

The Lambda function that’ll be notified.

Args

bus

Type Input<Object>

The bus to use.

bus.arn

Type Input<string>

The ARN of the bus.

bus.name

Type Input<string>

The name of the bus.

pattern?

Type Input<Object>

Filter the messages that’ll be processed by the subscriber.

If any single property in the pattern doesn’t match an attribute assigned to the message, then the pattern rejects the message.

For example, if your EventBus message contains this in a JSON format.

{
source: "my.source",
detail: {
price_usd: 210.75
},
"detail-type": "orderPlaced",
}

Then this pattern accepts the message.

{
pattern: {
source: ["my.source", "my.source2"],
}
}

pattern.detail?

Type Record<string, any>

A JSON object of “detail” values to match against. “detail” contains the actual data or information associated with the event.

{
pattern: {
detail: {
price_usd: [{numeric: [">=", 100]}]
}
}
}

pattern.detailType?

Type any[]

A list of “detail-type” values to match against. “detail-type” typically defines the kind of event that is occurring.

{
pattern: {
detailType: ["orderPlaced"]
}
}

pattern.source?

Type any[]

A list of “source” values to match against. “source” indicates where the event originated.

{
pattern: {
source: "my.source"
}
}

subscriber

Type Input<string | FunctionArgs>

The subscriber function.

transform?

Type Object

Transform how this subscription creates its underlying resources.

transform.rule?

Type EventRuleArgs | (args: EventRuleArgs, opts: ComponentResourceOptions, name: string) => void

Transform the EventBus rule resource.

transform.target?

Type EventTargetArgs | (args: EventTargetArgs, opts: ComponentResourceOptions, name: string) => void

Transform the EventBus target resource.