7 months ago
I have an nestJS backend on a monorepo with 5 different microservices and i want them to be called on demand and sleep most of the time, i thought about doing it with redis pub/sub but i think listening pub/sub dont let the service sleep? what can i do
5 Replies
to better explain: 1 microservice will be running 24/7 and that service will route messages on the pub/sub to different microservices so it will publish idk "send:message" and the message sender should wake up, send a message, sleep again and basically that for all the other 5 microservices but my question is the sleep part, idk if the listener for the redis pub/sub keeps the service awake and if so how to make it sleep and still work as expected
sleeping implies completely pausing the service’s execution as far as i understand, so it wouldn’t listen to redis anymore. you’d either have to adapt to redis streams and have the service check every x seconds/minutes with cron, or have another service up 24/7 listening to all channels, and triggering the microservices actions via an http route
yeah, i kinda figured it out yesterday… I just completely removed all redis from my project and implemented an endpoint /events wich receives an event_type and a data with all the data i need for that event
Status changed to Solved chandrika • 7 months ago
Status changed to Awaiting User Response Railway • 7 months ago
Status changed to Solved angelo-railway • 7 months ago