Event bus basics
This commit is contained in:
parent
1440ec51b7
commit
87e8af3f72
8 changed files with 88 additions and 16 deletions
22
app/core/woodpecker.py
Normal file
22
app/core/woodpecker.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import logging
|
||||
|
||||
from injectable import injectable
|
||||
|
||||
from app.events import SimpleEventBus
|
||||
from app.model.webhook import WebhookEvent
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@injectable
|
||||
class Woodpecker:
|
||||
|
||||
@SimpleEventBus.on(WebhookEvent)
|
||||
def on_event(self, event): # TODO: caller nie działa -> brakuje instancji klasy?
|
||||
logger.info(f"Received event: {event}")
|
||||
pass
|
||||
|
||||
|
||||
@SimpleEventBus.on(WebhookEvent)
|
||||
def on_event2(event): # TODO: Tu działa
|
||||
logger.info(f"F2: Received event: {event}")
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue