You Are Your Own Guru

We are born with a strong internal guidance system. Baby’s don’t think a split second before showing their discontent in an outrageous cry. Yet somehow on our way to adulthood, we are led to believe…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Revisiting Temporal Modeling with EventBridge Scheduler

In a nutshell, you gather your business invariants and analyze which ones have a temporal aspect to them. You then focus on capturing the passage of time associated with those invariants. In my example I used the fact that e-commerce orders usually have a remorse period, so you just want to advance the processing after that remorse period has passed.

I also presented a reference design that used a combination of AWS Step Functions and SQS to essentially schedule events that would only be fired at a specific timestamp.

Figure 1. Original scheduler solution using Step Functions.

In the original design, your domain would call startExecution of a step function that contains two states: a Wait and SendMessage. The first state would take care of guarding the timestamp and only transitioning to the next one when the time is right.

In the new design we could have simply the EventBridge Scheduler.

Figure 2. Revised design using EventBridge Scheduler.

As we can see, this new approach does not even need a queue as the scheduler has support to be an event source to trigger lambda executions.

In our example, we could specify for each placed order a one-time schedule named after the orderId and pass the lambda responsible for locking the order.

What is important is that you can also cancel scheduled events, so if something happens and you no longer want to be notified, you can tell EventBridge to remove the scheduled event.

I find this new service an interesting alternative, at least as powerful and even simpler than the original one with Step Functions.

Like always it is necessary to check your requirements against the service's SLA, but so far both on capacity — with a soft limit of 1 million schedulers — and cost — with a $1 per million after 14 million free invocations per month — it is applicable to a lot of scenarios.

Add a comment

Related posts:

Build a powerful table using React Table

Virtually every web application, and especially ones with reporting features, will require the use of an HTML table at one point or another. As the team that works on Greenhouse Reporting, we needed…

The Key to Embracing Solitude

Could you imagine a world with no boundaries, limits or expectations? A world where you could be whoever you wanted to be? A world with no assumptions or judgment? Because it’s easier said than done…

Night Shelter Appeals for More Volunteers to Help Manchester Rough Sleepers

A charity night shelter for rough sleepers in Manchester is appealing for more volunteers as the colder weather pushes in this winter. The Greater Together Manchester Night Shelter currently has 120…