AWS SQS FIFO 队列事件源,是否支持 maximumBatchingWindowInSeconds?

AWS SQS FIFO Queue event source, is maximumBatchingWindowInSeconds supported?

文档说现在支持 maximumBatchingWindowInSeconds 并且:

For a FIFO queue the maximum is 10. For a batch size over 10, you must also set the MaximumBatchingWindowInSeconds parameter to at least 1 second.

但是,我在尝试创建事件源映射时收到:“提供的请求无效:FIFO 队列不支持批处理 window”。

那么它是否支持,如果支持我该如何启用它?

我需要一个批量大小大于 10 的 FIFO 队列。

我正在使用 AWS CDK 创建资源堆栈。我的 EventSourceMapping 如下所示:

const cfnEventSourceMapping = new CfnEventSourceMapping(this, 'Auth0ImportQEventSourceMapping', {
  batchSize: 10,
  enabled: true,
  eventSourceArn: auth0ImportQ.queueArn,
  functionName: auth0ImportLambda.functionName,
  maximumBatchingWindowInSeconds: 10,
});

它的措辞有点混乱,但 MaximumBatchingWindowInSeconds 与 FIFO 队列不兼容。

FIFO 最大批次大小为 10,引用 MaximumBatchingWindowInSeconds 设置的句子谈到批次大小 >10,这不适用于 FIFO 队列。

只需删除 MaximumBatchingWindowInSeconds 即可。

MaximumBatchingWindowInSeconds 仅适用于标准队列(不是 FIFO):

(Streams and SQS standard queues) The maximum amount of time to gather records before invoking the function, in seconds. The default value is zero.

所以不要设置这个参数。此外,您还需要确保 fifo 队列的 Default visibility timeout 比 lambda 超时 更大

AWS 文档https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html 明确指出参数 MaximumBatchingWindowInSeconds 只能用于标准队列。而且FIFO不是标准队列。

Batch window – Specify the maximum amount of time to gather records before invoking the function, in seconds. Only applicable to standard queues.