Skip to content

Example of using actors from different files #676

@bagowix

Description

@bagowix

After reading all the documentation, all the examples that are in the repository and searching the whole internet for examples of implementation, I did not find the example I need.

Unfortunately, everywhere it is about initialization of broker and actors in one file, which is not very suitable for production code.

Here is an example of the implementation I was looking for:

FastAPI

app/core/dramatiq_service.py - broker initialization
app/tasks/foo/tasks.py - multiple actors
app/tasks/bar/tasks.py - multiple actors
app/main.py

first terminal: uvicorn main:app --host 0.0.0.0 --port 8001 --reload
second terminal: dramatiq core.dramatiq_service

All actors are initialized and run correctly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions