File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 88from .celery import init_celery
99from .config import AppConfig
1010from .di_container import Container
11+ from .dramatiq import init_dramatiq
1112from .logs import init_logger
1213from .storage import init_storage
1314
@@ -28,6 +29,7 @@ def application_init(app_config: AppConfig) -> InitReference:
2829 )
2930 init_logger (app_config )
3031 init_storage ()
32+ init_dramatiq (app_config )
3133 celery = init_celery (app_config )
3234
3335 return InitReference (
Original file line number Diff line number Diff line change 1+ from dramatiq import set_broker
2+ from dramatiq .brokers .stub import StubBroker
3+ from dramatiq .middleware import AsyncIO
4+ from opentelemetry_instrumentor_dramatiq import DramatiqInstrumentor
5+
6+ from .config import AppConfig
7+
8+
9+ def init_dramatiq (config : AppConfig ):
10+ DramatiqInstrumentor ().instrument ()
11+ if config .ENVIRONMENT == "test" :
12+ broker = StubBroker ()
13+ else :
14+ broker = StubBroker ()
15+ # broker.emit_after("process_boot")
16+ broker .add_middleware (AsyncIO ())
17+ set_broker (broker )
You can’t perform that action at this time.
0 commit comments