I want to add a method to my minos.cqrs.Service
to be executed every day at 9:00 AM. How can I do that?
Here is my current code:
from minos.cqrs import Service
class MyService(Service):
async def task(self) -> None:
print("Running periodic task...")
To add a periodic task to a
minos.cqrs.Service
class, you can create a standard handling method and decorate it with the@enroute.periodic.event
decorator fromminos.networks
and pass it a validcron
expression as argument (0 9 * * *
in your case).Here is an example: