Closed Kabanets closed 3 years ago
Hey @Kabanets!
We usually treat background processes as ports
— it's essentially another entry point to the application. Most often, it's a cron
port that triggers an application command on specific intervals.
It runs in a separate goroutine, just as the HTTP/gRPC servers or Pub/Sub handlers. An important point here is to treat all these goroutines as the same kind of workers. They should support cancellation (preferably by context
) and graceful shutdown in response to OS signals.
Hi @m110 Thank you for your response. It is a good idea. I will try to realize it. We are waiting for new chapters of the book
Thank you for your book and sample project. Can you share your mind about the place of background workers in clear architecture? I think it may be some entities in the app module or specific commands. Anyway, this is an important point of the project. What do you think?