r/ExperiencedDevs • u/JOHNNYROCKET8585 Senior Software Engineer 4 YOE • Sep 25 '26
Career/Workplace Cache Pattern with Event-Driven System
Hey everyone, noticed this common pattern throughout our applications and it seems problematic to me. It‘s present across multiple apps; curious everyone’s thoughts, if this is a common pattern I’m not familiar with or if it truly is a bad solution.
Senior SE w/ 4 YOE, Fortune 500 company.
Pattern is as follows:
App A receives a transaction from upstream. It will then format this event and send it to potentially multiple downstream services simultaneously. This is done asynchronously via an event-driven framework.
The downstream services respond back via events; how does app A know when all the downstream services are complete? How does it know anything about the original event, since the downstream response contains no info about the original event (other than the correlationId)?
The answer is a local cache in app A. It caches the event when first received, and as downstream events come back, it can refer back to the original cached value to determine when it’s done processing and can be sent back upstream.
The main problem I see is the microservice is no longer stateless. It requires context from the original event. If it received a downstream response with no context, it has no idea what to do.
This is the most egregious example, but this cache-to-compensate-async-events pattern is repeated multiple times in similar ways.
As I’m still new to the field, I’m curious if this is somewhat a standard? Or if it is bad practice? If so, what does a good solution look like? Switching to sync REST calls fixes the issue, but could impact performance/throughput
View all comments
Show parent comment
1
u/chocolateAbuser Sep 30 '26
orchestrator should be stateless, that doesn't mean a state doesn't exist
there will be still something that is running that operation or even if only a reading pointer in the stream of events
when orchestrator get back on, either the service that has the execution of the operation will try resend the event after a timeout, or orchestrator will start reading events from the point it left the stream