QueueLambdaSubscriber
Reference doc for the `sst.aws.QueueLambdaSubscriber` component.
The QueueLambdaSubscriber
component is internally used by the Queue
component to
add a consumer to Amazon SQS.
You’ll find this component returned by the subscribe
method of the Queue
component.
Constructor
Parameters
-
name
string
-
args
Args
-
opts?
ComponentResourceOptions
Properties
nodes
Type Object
The underlying resources this component creates.
nodes.eventSourceMapping
Type EventSourceMapping
The Lambda event source mapping.
nodes.function
Type Output
<
Function
>
The Lambda function that’ll be notified.
Args
batch?
Type Input
<
Object
>
Default {size: 10, window: “20 seconds”, partialResponses: false}
Configure batch processing options for the consumer function.
batch.partialResponses?
Type Input
<
boolean
>
Default false
Whether to return partial successful responses for a batch.
Enables reporting of individual message failures in a batch. When enabled, only failed messages become visible in the queue again, preventing unnecessary reprocessing of successful messages.
The handler function must return a response with failed message IDs.
Read more about partial batch responses.
Enable partial responses.
For a batch of messages (id1, id2, id3, id4, id5), if id2 and id4 fail:
This makes only id2 and id4 visible again in the queue.
batch.size?
Type Input
<
number
>
Default 10
The maximum number of events that will be processed together in a single invocation of the consumer function.
Value must be between 1 and 10000.
Set batch size to 1. This will process events individually.
batch.window?
Type Input
<
“
${number} minute
”
|
“
${number} minutes
”
|
“
${number} second
”
|
“
${number} seconds
”
>
Default “0 seconds”
The maximum amount of time to wait for collecting events before sending the batch to the consumer function, even if the batch size hasn’t been reached.
Value must be between 0 seconds and 5 minutes (300 seconds).
filters?
Type Input
<
Input
<
Record
<
string
, any
>
>
[]
>
Filter the records that’ll be processed by the subscriber
function.
You can pass in up to 5 different filter policies. These will logically ORed together. Meaning that if any single policy matches, the record will be processed. Learn more about the filter rule syntax.
For example, if you Queue contains records in this JSON format.
To process only those records where the RequestCode
is BBBB
.
And to process only those records where RecordNumber
greater than 9999
.
queue
Type Input
<
Object
>
The queue to use.
queue.arn
Type Input
<
string
>
The ARN of the queue.
subscriber
Type Input
<
string
|
FunctionArgs
>
The subscriber function.
transform?
Type Object
Transform how this component creates its underlying resources.
transform.eventSourceMapping?
Type EventSourceMappingArgs
|
(
args
:
EventSourceMappingArgs
,
opts
:
ComponentResourceOptions
,
name
:
string
)
=>
void
Transform the Lambda Event Source Mapping resource.