LambdaQ v2; now with optional task tokens!

🔗 Thursday, 9 May 2024 • Cariad Eccleston • @cariad@gamedev.lgbt

Want to use SQS without Step Functions? Now LambdaQ supports SQS without Step Functions.

A screenshot of the AWS Step Functions console showing the numbers 100 and 15 being summed.

LambdaQ (“lambda-queue”) is my Python package that helps you write Amazon Web Services Lambda functions that can be called directly and by messages on SQS queues. The package takes care of the event handling, message deserialisation and API calls, while you focus on writing decoupled, testable message-handling code.

Now… it turns out that v1 makes the slightly short-sighted assumption that messages are published onto queues only by Step Functions state machines and always with task tokens to describe success or failure.

And that put me on the spot today when I needed to publish to a queue directly in code. A Step Functions token doesn’t make sense when you’re publishing outside of Step Functions–and even if you are using Step Functions, you don’t always want to publish and wait for a response.

Tokens should be optional. So, in v2, they are! And… that’s about it. I bumped the major version up only because I adjusted the argument order of handle_event to maintain alphabetical order. That sort of thing bothers me perhaps more than it ought to.

Anyway, that’s the lot! LambdaQ v2 requires Python 3.10 or later and can be installed from PyPI.

pip install lambdaq

The code is released under the MIT licence at github.com/cariad/lambdaq, too.

Have fun!