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 #158 from Clariteia/0.0.3
0.0.3
- Loading branch information
Showing
85 changed files
with
2,172 additions
and
1,661 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,3 +106,5 @@ ENV/ | |
|
||
# Intellij IDEa / PyCharm / etc. | ||
.idea | ||
|
||
docs/api |
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 +1 @@ | ||
.. include:: ../AUTHORS.rst | ||
.. include:: ../AUTHORS.md |
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 +1 @@ | ||
.. include:: ../HISTORY.rst | ||
.. include:: ../HISTORY.md |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
======= | ||
Modules | ||
======= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
api/minos |
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 +1 @@ | ||
.. include:: ../README.rst | ||
.. include:: ../README.md |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
Copyright (C) 2021 Clariteia SL | ||
This file is part of minos framework. | ||
Minos framework can not be copied and/or distributed without the express permission of Clariteia SL. | ||
""" | ||
from __future__ import ( | ||
annotations, | ||
) | ||
|
||
from typing import ( | ||
Optional, | ||
) | ||
|
||
from minos.common import ( | ||
CommandReply, | ||
MinosConfig, | ||
MinosModel, | ||
) | ||
|
||
from .abc import ( | ||
Broker, | ||
) | ||
|
||
|
||
class CommandReplyBroker(Broker): | ||
"""Minos Command Broker Class.""" | ||
|
||
ACTION = "commandReply" | ||
|
||
def __init__(self, *args, saga_id: str, task_id: str, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.saga_id = saga_id | ||
self.task_id = task_id | ||
|
||
@classmethod | ||
def _from_config(cls, *args, config: MinosConfig, **kwargs) -> CommandReplyBroker: | ||
return cls(*args, **config.saga.queue._asdict(), **kwargs) | ||
|
||
async def send( | ||
self, | ||
items: list[MinosModel], | ||
topic: Optional[str] = None, | ||
saga_id: Optional[str] = None, | ||
task_id: Optional[str] = None, | ||
**kwargs | ||
) -> int: | ||
"""Send a list of ``Aggregate`` instances. | ||
:param items: A list of aggregates. | ||
:param topic: Topic in which the message will be published. | ||
:param saga_id: Saga identifier. | ||
:param task_id: Saga execution identifier. | ||
:return: This method does not return anything. | ||
""" | ||
if topic is None: | ||
topic = self.topic | ||
if saga_id is None: | ||
saga_id = self.saga_id | ||
if task_id is None: | ||
task_id = self.task_id | ||
command_reply = CommandReply(topic=topic, items=items, saga_id=saga_id, task_id=task_id) | ||
return await self._send_bytes(command_reply.topic, command_reply.avro_bytes) |
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
Oops, something went wrong.