-
Notifications
You must be signed in to change notification settings - Fork 5
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 #70 from taskiq-python/develop
release 0.2.0
- Loading branch information
Showing
8 changed files
with
65 additions
and
36 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,2 +1,3 @@ | ||
"""FastStream - taskiq integration to schedule FastStream tasks.""" | ||
__version__ = "0.1.8" | ||
|
||
__version__ = "0.2.0" |
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,45 @@ | ||
from dataclasses import dataclass | ||
from typing import Any, Dict | ||
|
||
from taskiq.abc.formatter import TaskiqFormatter | ||
from taskiq.message import TaskiqMessage | ||
|
||
|
||
@dataclass | ||
class PathcedMessage: | ||
"""DTO to transfer data to `broker.kick`.""" | ||
|
||
body: Any | ||
labels: Dict[str, Any] | ||
|
||
|
||
class PatchedFormatter(TaskiqFormatter): | ||
"""Default taskiq formatter.""" | ||
|
||
def dumps( # type: ignore[override] | ||
self, | ||
message: TaskiqMessage, | ||
) -> PathcedMessage: | ||
""" | ||
Dumps taskiq message to some broker message format. | ||
:param message: message to send. | ||
:return: Dumped message. | ||
""" | ||
labels = message.labels | ||
labels.pop("schedule", None) | ||
labels.pop("schedule_id", None) | ||
|
||
return PathcedMessage( | ||
body=labels.pop("message", None), | ||
labels=labels, | ||
) | ||
|
||
def loads(self, message: bytes) -> TaskiqMessage: | ||
""" | ||
Loads json from message. | ||
:param message: broker's message. | ||
:return: parsed taskiq message. | ||
""" | ||
raise NotImplementedError |
This file was deleted.
Oops, something went wrong.
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