Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dlq): Removed Generic payload from DLQ Policy #49

Merged
merged 2 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeadLetterQueue(ProcessingStep[TPayload]):
def __init__(
self,
next_step: ProcessingStep[TPayload],
policy: DeadLetterQueuePolicy[TPayload],
policy: DeadLetterQueuePolicy,
) -> None:
self.__next_step = next_step
self.__policy = policy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from abc import ABC, abstractmethod
from typing import Generic

from arroyo.types import Message, TPayload

Expand All @@ -12,7 +11,7 @@ def __str__(self) -> str:
return f"Invalid Message: {self.message}"


class DeadLetterQueuePolicy(ABC, Generic[TPayload]):
class DeadLetterQueuePolicy(ABC):
"""
A DLQ Policy defines how to handle an invalid message.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
DeadLetterQueuePolicy,
InvalidMessage,
)
from arroyo.types import TPayload
from arroyo.utils.metrics import get_metrics


Expand All @@ -19,7 +18,7 @@ class _Bucket(NamedTuple):
hits: int


class CountInvalidMessagePolicy(DeadLetterQueuePolicy[TPayload]):
class CountInvalidMessagePolicy(DeadLetterQueuePolicy):
"""
Ignore invalid messages up to a certain limit per time unit window in seconds.
This window is 1 minute by default. The exception associated with the invalid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
DeadLetterQueuePolicy,
InvalidMessage,
)
from arroyo.types import TPayload
from arroyo.utils.metrics import get_metrics


class IgnoreInvalidMessagePolicy(DeadLetterQueuePolicy[TPayload]):
class IgnoreInvalidMessagePolicy(DeadLetterQueuePolicy):
def __init__(self) -> None:
self.__metrics = get_metrics()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
DeadLetterQueuePolicy,
InvalidMessage,
)
from arroyo.types import TPayload


class RaiseInvalidMessagePolicy(DeadLetterQueuePolicy[TPayload]):
class RaiseInvalidMessagePolicy(DeadLetterQueuePolicy):
def handle_invalid_message(self, e: InvalidMessage) -> None:
raise e