-
-
Save civic/7b0f482b15fac8bcda4c3f08a26d3a43 to your computer and use it in GitHub Desktop.
consumer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import json | |
log = logging.getLogger(__name__) | |
log.setLevel(logging.DEBUG) | |
def lambda_handler(event, context): | |
for record in event['Records']: | |
message_id = record['messageId'] | |
attributes = record['attributes'] | |
approximateReceiveCount = attributes['ApproximateReceiveCount'] | |
body = record['body'] | |
msg = json.loads(body) | |
log.info("Consumed a message: no=[%s], messageId=[%s], ApproximateReceiveCount=[%s]", | |
msg['no'], message_id, approximateReceiveCount) | |
log.info("Finish %d records", len(event['Records'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment