AWS Lambda: The Dispatch Board
A custom boba order can wait at the counter, receive an order number, or sit on a ticket rail. Lambda behaves differently for each arrival path.
The Business Goal
Byte Burger’s new custom-drink service works in a demo. Under real traffic, customers ask why some failures appear immediately, some appear later, and some orders wait on the kitchen rail. The team calls all three “a Lambda trigger.” That hides who is waiting, who retries, and whether the customer has actually received a result.
The Story
A customer asks the runner to calculate the price of a custom boba drink while waiting at the counter. That is one kind of call. Another customer drops a pickup ticket into the order tray and receives an order number; the runner will work it later. Behind the counter, runners repeatedly pull groups of tickets from a rail. Same runner, different dispatch rules.
Meet the AWS Service
Lambda supports synchronous and asynchronous invocation. It also uses event source mappings to poll supported queues and streams, then invoke a function with retrieved records. The invocation model determines when a caller gets a response and who owns important failure behavior.
Core idea: Before deciding how to handle failure, know whether the caller waits, Lambda queues the event, or Lambda polls the source.
How It Works
Customer waits at the counter
Synchronous invocation
API Gateway or a direct caller can invoke Lambda synchronously. The caller waits for the function result or error. Lambda does not automatically retry a function-code error for a direct synchronous invocation; the caller or invoking service determines the next move.
Customer receives an order number
Asynchronous invocation
Services such as EventBridge, SNS, and S3 can invoke Lambda asynchronously. Lambda first queues the event for processing and returns acceptance to the invoker. Success later does not mean the original caller remained connected.
Runners pull the ticket rail
Event source mapping
For SQS, Kinesis, and DynamoDB Streams, Lambda polls the source and invokes the function with one or more records. The source, mapping configuration, batch behavior, and record type shape retry and ordering behavior.
Architectural Mapping
| In Byte Burger | In AWS | What it means |
|---|---|---|
| Customer waits for price | synchronous invocation | Caller waits for response |
| Order number at pickup | asynchronous invocation | Event accepted for later processing |
| Ticket rail | queue/stream event source | Source retains records |
| Runner collecting tickets | event source mapping | Lambda polls and invokes batches |
When to Use It
- Use synchronous invocation when the caller needs an immediate result.
- Use asynchronous invocation when the work can continue after acceptance.
- Use a queue or stream mapping when the source should buffer or sequence records.
When Not to Use It
- Do not tell a customer “the drink is ready” merely because asynchronous work was accepted.
- Do not treat queue polling as identical to an EventBridge or SNS async invocation.
Painkiller
Problem: One function can receive work through fundamentally different arrival paths.
Pain: Treating every trigger alike creates incorrect response and recovery behavior.
AWS solution: Choose the invocation model that matches who waits and who owns delivery.
Knife Cut
Asynchronous acceptance means “ticket received,” not “errand completed.”
The Masthead
What Actually Just Happened
| Story element | AWS | Precise meaning |
|---|---|---|
| Counter conversation | synchronous call | Immediate response path |
| Pickup number | asynchronous call | Lambda-managed event queue |
| Ticket rail | event source | Records remain with source |
A Note From the Author
The dispatcher does not make all sources identical. Retry, batching, ordering, scaling, and failure destinations vary by invocation method and source. Verify the exact integration before relying on a default. Lambda invocation methods are the source of truth.
The Last Bite
The same runner can serve three paths. The path decides what “done” and “failed” mean.
Next chapter: AWS Lambda: The Recovery Shelf
One custom order spills during preparation. Byte Burger needs a recovery path that does not lose or blindly duplicate the ticket.