How to implement "debouncing" for event-driven microservices?

11/24/2020

I have 2 microservices running in a Kubernetes cluster on Azure. The "Project"-microservice sends out an event to Kafka when a project has been updated. The "Analytics"-microservice consumes the event, does some expensive calculations, and finally sends out an e-mail containing the results.

To avoid spamming the receiver, I want to implement some kind of debouncing pattern so that calculations are only done when an hour has passed since receiving the last update-event. Since the "Analytics"-microservice would be idle for most of the time and cold starts are not a problem, it would be advantageous if resources are unreserved while it is inactive.

How would one implement a debouncing scenario when using Kafka? I have thought of introducing a less resource-intensive microservice with the sole purpose of triggering the "Analytics"-microservice once an internal clock has expired. Is this a sensible solution? I would appreciate the input of someone who has dealt with a similar problem before.

-- andreas_rwth
apache-kafka
azure
azure-functions
kubernetes
microservices

1 Answer

11/25/2020

Did you consider Temporal’s durable timers. See here: https://docs.temporal.io/docs/workflows/

You can also consider combining Temporal with Spiderwiz to streamline your entire workflow.

-- zvil
Source: StackOverflow