You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any advice on how to run a hosted service inside a module?
This repo does not seem to give any example of how to properly use a hosted service inside of a module.
For context:
MassTransit will by default register a hosted service. If we do register MassTransit inside a module's own container, this hosted service is never started as the module is not actually plugged into the Host's startup (host.Run()).
The idea I'm currently working around is using IHostApplicationLifetime as an input for the module Initialization method. Something along the lines:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Is there any advice on how to run a hosted service inside a module?
This repo does not seem to give any example of how to properly use a hosted service inside of a module.
For context:
MassTransit will by default register a hosted service. If we do register MassTransit inside a module's own container, this hosted service is never started as the module is not actually plugged into the Host's startup (host.Run()).
The idea I'm currently working around is using IHostApplicationLifetime as an input for the module Initialization method. Something along the lines:
And, inside the module, hook into host's ApplicationStarted:
I'm wondering has anyone had a similar problem, and what was their approach?
Beta Was this translation helpful? Give feedback.
All reactions