The goal of dramatiq is to process some task on another system process. If your tasks will be done on the same process, you read the wrong soluce. But if your tasks can be execute in another process, and its take time to process them, your are welcome
The first thing to known is you will need to run to application:
Make attention that the both use the same broker, else they should not be communicate each other.
Warning
the blok dramatiq
must be installed
To execute your task by dramatiq, you have to define actor or actor_send on your AnyBlok Model.
Read the doc of the doc of dramatiq
blok to know how declare it.
dramatiq allow to add middleware to improve the process, anyblok_dramatiq add one middleware for historize the messages and their status.
You can add in your project an existing dramatiq middleware or your own. read more to known existing middleware or how create your own.
anyblok_dramatiq add this own console script to run the workers, you need add the middleware in the entrypoint anyblok_dramatiq.middleware
:
setup(
...
entry_points={
'anyblok_dramatiq.middleware': [
'mymiddleware=module.path:ClassName',
],
},
...
)