Nice solution, Ross! Sharing your concern about putting to much control logic into message consuming Lambda my initial reaction was to put into a Step Function State Machine (yes, it will cost you an extra Lambda and Step Function call leg, but async message processing mb less latency sensitive) thus leaving the message consumer to deal exclusively with business logic. As nice side effect if that then this control logic state machine might be packaged as a standard infrastructure solution applicable to any problem. It will also not subtract from the Lambda timeout budget. An alternative would be to put a generic middleware filter similar to what https://github.com/middyjs/middy are doing. Each approach has its pro and contra. Ideally, some infrastructure magic would chose the best for you.

Software technologist/architect; connecting dots across multiple disciplines; C-level mentoring

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store