From f677140f0310a169693e2e657d532ad21052e7a2 Mon Sep 17 00:00:00 2001 From: mr-raccoon-97 Date: Thu, 14 Nov 2024 21:37:01 +0000 Subject: [PATCH] Change subscribe method / enhace docstrings --- pybondi/session.py | 11 +++++++---- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pybondi/session.py b/pybondi/session.py index a54df0f..cae9bc0 100644 --- a/pybondi/session.py +++ b/pybondi/session.py @@ -19,21 +19,24 @@ class Session: @classmethod def add_event_handler(cls, event_type: type[Event], handler: Callable[[Event], None]): """ - Adds an event handler for a given event type. + Adds an event handler for a given event type, when a new session is created + if no message bus is provided. """ cls.event_handlers.setdefault(event_type, []).append(handler) @classmethod def add_command_handler(cls, command_type: type[Command], handler: Callable[[Command], None]): """ - Adds a command handler for a given command type. + Adds a command handler for a given command type, when a new session is created + if no message bus is provided. """ cls.command_handlers[command_type] = handler @classmethod - def subscribe(cls, subscriber: Subscriber): + def add_subscriber(cls, subscriber: Subscriber): """ - Subscribes a subscriber to the session. + Add a subscriber to the publisher session, when a new session is created + if no publisher is provided. """ cls.subscribers.append(subscriber) diff --git a/pyproject.toml b/pyproject.toml index 03ba2aa..7cce20c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybondi" -version = "0.2.6" +version = "0.2.7" description = "A lightweight library for creating event driven systems using domain driven design." authors = ["Eric Cardozo "] license = "MIT"