Next, we are going to add something to consume the events we are sending to our event bus!
We will use AWS Step Functions to process our wishlist events. We will have one workflow for processing LEGO gift requests and one for processing surprise gift requests.
We will use Express Workflows as these are better suited to event processing than Standard Workflows.
Add state machine for LEGO gifts
Wishlists that include a LEGO gift need to be sent to the LEGO Event-Driven Elves 🧝♂️, via another EventBridge event bus. You will need to setup a central event bus to receive these events - this can be done via the AWS Console. And don't forget to append your elf source (e.g. elf-luke) to the event you send so the elves know where the gift request has come from:
Bonus: Add a nice message to the elves as part of the event detail, like: "Hey LEGO Event-Driven Elves, {from} would like LEGO set {legoSKU}. Thanks!"
Add state machine for surprise gifts
Wishlists that include a surprise gift can to be sent direct to the workshop, ready for random gift selection, via an S3 bucket. You can ask the Event-Driven Elves for the central bucket ARN too. Again, don't forget to append your elf source to the object!
Now we have our Step Functions workflows, we need to add rules to our event bus, per gift type, to execute the state machines based on the gift requested.