โ Back to Amazon EventBridge
๐ข Amazon EventBridge: cheat sheet
๐จ The analogyA school announcements office that reads each notice and sends it to whoever its rulebook names.
๐ The regular explanationAWS's serverless event router. Producers put JSON events on an event bus, rules match each event's content against event patterns, and every match is delivered at least once to up to five targets, with retries, dead-letter queues, archive and replay, plus a separate Scheduler for timed invocations.
- The football coach writes a notice saying the match has moved, hands it in at the announcements office and gets on with the day.
- The office checks the notice against every rule in the rulebook. The sport rule fits; the trip rule doesn't.
- The sport rule sends the notice to the PE teacher, the one person on its list.
- Ms Lee hands in a notice about a zoo trip. This time the trip rule fits and the sport rule doesn't.
- The trip rule has two names on its list, so the notice goes to the office tray and to the parents' group. Ms Lee never had to tell anyone.
- The boiler goes off and the caretaker's notice turns up at the main office by itself. Nobody had to set anything up. The main office's rule sends it to the head teacher.
- The drama club hands its own notice in at its own desk, with its own rulebook. Ticket notices go to the ticket tray.
- The leisure centre hands in "pool closed" at the visitors' desk. The school's rule there sends it to the PE teacher.
- Each office only sees its own notices and checks them against its own rulebook, so the boiler never gets mixed up with the play.
- Ms Lee hands in a notice saying a zoo trip is booked and costs 12 pounds.
- The office reads the whole notice. It's a booked trip, so the first rule fits, and it costs money, so the second rule fits too.
- The first rule tells the parents' group and the trip planner. The second puts the notice in the payments tray so someone collects the money.
- Next, a free museum trip. Only the first rule fits, so the parents and the planner hear about it and the payments tray stays quiet.
- Ms Lee's trip notice comes in, and the trip rule says to phone the coach company.
- The office calls, but the coach company's line is busy.
- The office tries again later, then later still, waiting a bit longer each time, for up to a day.
- The day is up, so the office puts the notice in the undelivered box instead of throwing it away.
- The coach company is back. The office manager takes the notice out of the box and sends it again.
- On Monday two trip notices come in. The office copies each one into the binder and sends it on, but the report helper gets the sums wrong.
- By Wednesday the mistake is fixed. Monday's notices are long gone from everyone's desk, but the binder still has them.
- The office takes Monday's copies out of the binder and feeds them through the rulebook again. That's a replay.
- The trip rule sends them to the helper again, and this time the sums are right. The binder doesn't copy them twice.
- Monday, 8:30 school time. The bell rings and calls the register helper straight away. No notice and no rulebook needed.
- Tuesday, 8:30 again. The bell rings and calls the same helper.
- Sports day, 10 o'clock. The one-day bell rings and the sports day planner starts the races.
- The one-day bell was set to tidy itself away once done, so it does. The weekday bell keeps ringing.
๐งฉ Key questions
- Ms Lee hands in a notice about a free trip. One rule wants any booked trip, another wants trips that cost money. Who gets it?
- Only the people on the first rule's list. The office reads the whole notice. The second rule asks for a cost, and this trip is free, so only the first rule fits.
- The coach company's line stays busy all day. What happens to the notice if the office has an undelivered box for it?
- The office keeps trying with longer and longer waits, then puts it in the undelivered box. Trying again and again copes with short problems, and the box means nothing is lost when the problem lasts.
- Now and then a helper receives the same notice twice. What should helpers do about it?
- Check the notice number and ignore one they've already handled. The office sometimes sends twice to make sure a notice arrives, so receivers should cope with repeats.
- The report helper got Monday's sums wrong, and it's now Wednesday. How can the helper see Monday's notices again?
- Replay Monday's copies from the copy binder through the rulebook. Only the copy binder keeps notices after they've been sent on, and a replay feeds them through the rules again.
- The register must start every school day at 8:30 school time, even after the clocks change. What do you use?
- The timetable bell, set to every weekday at 8:30 with the school's time zone. The bell knows which part of the world the school is in, so 8:30 stays 8:30 all year. A timer in the rulebook only follows one fixed world clock, so it would be an hour out after the clocks change.