I use SignalR backplane with Redis. Its my first microservice.
The second microservice must subscribe to channel used to publish SignalR messages. But the problem is about where should I subscribe (in ASP NET app) to this event, if I want to use Dependency Injection (because I want to save published messages to database)?
IHostedService
is the way to go - you can inject, what you wants here and set IHostedService
for infinite run.