This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #445 from Clariteia/0.2.0
0.2.0
- Loading branch information
Showing
72 changed files
with
666 additions
and
995 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
from .abc import ( | ||
from .messages import ( | ||
REPLY_TOPIC_CONTEXT_VAR, | ||
Command, | ||
CommandReply, | ||
CommandStatus, | ||
Event, | ||
) | ||
from .publishers import ( | ||
Broker, | ||
BrokerSetup, | ||
) | ||
from .command_replies import ( | ||
CommandReplyBroker, | ||
) | ||
from .commands import ( | ||
REPLY_TOPIC_CONTEXT_VAR, | ||
CommandBroker, | ||
) | ||
from .events import ( | ||
CommandReplyBroker, | ||
EventBroker, | ||
) | ||
from .producers import ( | ||
Producer, | ||
) | ||
from .services import ( | ||
ProducerService, | ||
) | ||
from .subscribers import ( | ||
CommandHandler, | ||
CommandHandlerService, | ||
Consumer, | ||
ConsumerService, | ||
DynamicHandler, | ||
DynamicHandlerPool, | ||
EventHandler, | ||
EventHandlerService, | ||
Handler, | ||
HandlerEntry, | ||
HandlerRequest, | ||
HandlerResponse, | ||
HandlerResponseException, | ||
HandlerSetup, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from __future__ import ( | ||
annotations, | ||
) | ||
|
||
from contextvars import ( | ||
ContextVar, | ||
) | ||
from enum import ( | ||
IntEnum, | ||
) | ||
from typing import ( | ||
Any, | ||
Final, | ||
Optional, | ||
) | ||
from uuid import ( | ||
UUID, | ||
) | ||
|
||
from minos.common import ( | ||
DeclarativeModel, | ||
) | ||
|
||
REPLY_TOPIC_CONTEXT_VAR: Final[ContextVar[Optional[str]]] = ContextVar("reply_topic", default=None) | ||
|
||
|
||
class Command(DeclarativeModel): | ||
"""Base Command class.""" | ||
|
||
topic: str | ||
data: Any | ||
saga: Optional[UUID] | ||
reply_topic: str | ||
user: Optional[UUID] | ||
|
||
|
||
class CommandReply(DeclarativeModel): | ||
"""Base Command class.""" | ||
|
||
topic: str | ||
data: Any | ||
saga: Optional[UUID] | ||
status: CommandStatus | ||
service_name: Optional[str] | ||
|
||
@property | ||
def ok(self) -> bool: | ||
"""Check if the reply is okay or not. | ||
:return: ``True`` if the reply is okay or ``False`` otherwise. | ||
""" | ||
return self.status == CommandStatus.SUCCESS | ||
|
||
|
||
class CommandStatus(IntEnum): | ||
"""Command Status class.""" | ||
|
||
SUCCESS = 200 | ||
ERROR = 400 | ||
SYSTEM_ERROR = 500 | ||
|
||
|
||
class Event(DeclarativeModel): | ||
"""Base Event class.""" | ||
|
||
topic: str | ||
data: Any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from .abc import ( | ||
Broker, | ||
BrokerSetup, | ||
) | ||
from .command_replies import ( | ||
CommandReplyBroker, | ||
) | ||
from .commands import ( | ||
CommandBroker, | ||
) | ||
from .events import ( | ||
EventBroker, | ||
) | ||
from .producers import ( | ||
Producer, | ||
) | ||
from .services import ( | ||
ProducerService, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.