Got a function triggered on kinesis stream messages (serverless.yml):
functions:
kinesis-handler:
handler: kinesis-handler.handle
events:
- stream:
type: kinesis
arn:
Fn::Join:
- ':'
- - arn
- aws
- kinesis
- Ref: AWS::Region
- Ref: AWS::AccountId
- stream/intercom-stream
startingPosition: LATEST
batchSize: 100
enabled: true
The function does get triggered eventually (2-5 sec after the message is sent) but not immediately. Is this by design? Can I assume kinesis data streams are not good for (near) real time event driven architecture?
What actually triggers a lambda when the trigger is a kinesis stream? It looks like there's just background periodic polling every 1-2 sec, the lambda is triggered if new messages found in the stream.