amazon-archives / aws-serverless-sqs-event-source Goto Github PK
View Code? Open in Web Editor NEWA serverless app that polls an SQS queue and invokes a given lambda function to process the messages
License: MIT No Attribution
A serverless app that polls an SQS queue and invokes a given lambda function to process the messages
License: MIT No Attribution
The "messageAttributes" object is empty on incoming events even though my messages all should contain one attribute.
"messages": [
{
"messageId": "a5df8a12-ae1d-4a1d-b352-c8aafbe4dc4b",
"receiptHandle": "AQEBtYpGgK/MU2rTPCMsV8f+glYkIZ+Jbsptce9qPk4+00y9cOwsP33I9zj8+U0OA0jt4UTkhf/4igPE/mOhz37TFCOEGtkEB12sRNgN+bufASfwFGIUQ5tSYJIZ9QduULuO15IDFH0JAVrOIdq8ZSM3BLcV3EiD7VXha2CIg2mXmqkpcJyfcVl6kVN9WjYCWLBto6RGorejeJ9dAsn7AJcYr546oXk4z5z0q79NRq59F4Q3DESsmNYvGqjOOHOs8aJ5OXzKM4EaH7ZZwhsU+lDocNMqMLOPRPY3J34sbK4A4Te1lsOSkGE9T1CnijwZBnO00mUB/7vpvfPrXs+j/2riz7pqf8mT8Ygwblry+KKz7wTUbLt5fFpgAJqm2QUSvIdu2DI+I4b+4b3ro6OMa/G3Nw==",
"mD5OfBody": "2301f613c4160a6cf522a340da376150",
"body": "{<EXAMPLE_BODY>}",
"messageAttributes": {}
},
{
"messageId": "7c5200d2-22be-4d62-a7b1-9ac6aac2218c",
"receiptHandle": "AQEBo1djdqdLSi5Hwzy8lxcYW9C9H/kxc5pfbbLDaQhOPUFARuOlRMaahEqGU6+GrCUYnzO2CEnoIiBm6DHK3LMN7HO2RfRC/iMLjmkFbLLkWKwL2R9IsH3r6t7kiuYWfbYD0fCh0a/Cl/xkwBrE+WCfJCX3Flkl1zR5zZD/EBmnkx20PKu5u6fEGofJNKm17SAqr8IVh6eDyBb9zHig5sUvCWDrByH9jpW3gaxSKLAHJHAEIj1uyHhxGS39SaqJA6LydxsA+xwZwOjX4PYxuMT7yXgmrVm/vWQ//uL7vy1dX/BydNdSqt+4ZKJ71/phHx5TmrKS1RDDJc/enrKOw6EJTcT9ECtDg2DPjEJyspTp2n2UMTvzLbSf4kysxg1znFffnr2OOpqIRpCglE45cixi2Q==",
"mD5OfBody": "7295178dfd60ce94607294d7460fd4b7",
"body": "{<EXAMPLE_BODY>}",
"messageAttributes": {}
}
]
Currently, the SQSPoller is invoked by the CW Event schedule and invokes the message processor to process batches of messages synchronously. The current algorithm works and is cost-efficient, but cannot support high throughput. An alternative would be if the SQSPoller and MessageDispatcher classes were put into separate lambda functions and the SQSPoller invoked the MessageDispatcher lambda function asynchronously to process a batch of messages, then continued on. The MessageDispatcher lambda function would handle updating the queue with results of the execution of its batch of messages. This would dramatically increase parallelism of message processing. One caveat is that a high volume queue could lead to too many lambdas being invoked, causing the account to hit its concurrency limit. However, setting a concurrency limit on the MessageProcessor function could be used to control how many concurrent invocations would be supported.
Hello,
I've set everything up and the correct lambda function is being successfully executed.
The SQSPoller logs indicate this success is received. INFO MessageDispatcher:62 - Processed 10 messages in 1399ms. perMessageAverage=139ms
Then it crashes before any messages can be removed from the SQS queue. It gives this stack trace
java.lang.NullPointerException: java.lang.NullPointerException
java.lang.NullPointerException
at com.amazonaws.serverless.sqseventsource.MessageDispatcher.dispatch(MessageDispatcher.java:52)
at com.amazonaws.serverless.sqseventsource.SQSPoller.poll(SQSPoller.java:39)
at com.amazonaws.serverless.sqseventsource.lambda.SQSPollerHandler.handleRequest(SQSPollerHandler.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Any help would be appreciated!
Thanks,
Andrew
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.