I’m developing a Microservice-based system in predominantly (there are a few components written in Python) AdonisJS.
I just had a little question. To help make things clear, here is a simpler structure of my application.
I’ll focus on two components. The first is my Accounts Service. The Accounts Service is the “Gateway” Service to my system. It handles creating new users, authentication, request routing to other services in the system, and so on.
The second service is a Profile Service, handling user profile information and payments information.
These two services are connected via a Redis Event Store and pub/sub pattern amongst the services, which is made easy because Redis has first-class support. When a new user is created in the Accounts Service, the Accounts Service publishes an event to the Event store with user info. The Profile Service then consumes that event and creates a profile for the newly created user. And, of course, the other services in that system also consume the event and do what they need with it.
Now, suppose, my Profile Service goes down. While it’s down, the Accounts Service publishes three new user events. When the Profile Service goes back up, umm, it won’t be in sync with the rest of the system.
So, that is where I am having trouble.
I realize i’d need some kind of hook after the Http Server starts. But, how would I go about querying Redis for the unconsumed events? The Docs on the Adonis site don’t seem to have anything on it.