-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catch errors from event driver publish retries (#1264)
- Loading branch information
Showing
4 changed files
with
81 additions
and
13 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,14 +1,21 @@ | ||
from __future__ import annotations | ||
|
||
from attrs import define | ||
from typing import Callable, Optional | ||
|
||
from attrs import define, field | ||
|
||
from griptape.drivers import BaseEventListenerDriver | ||
|
||
|
||
@define | ||
class MockEventListenerDriver(BaseEventListenerDriver): | ||
try_publish_event_payload_fn: Optional[Callable[[dict], None]] = field(default=None, kw_only=True) | ||
try_publish_event_payload_batch_fn: Optional[Callable[[list[dict]], None]] = field(default=None, kw_only=True) | ||
|
||
def try_publish_event_payload(self, event_payload: dict) -> None: | ||
pass | ||
if self.try_publish_event_payload_fn is not None: | ||
self.try_publish_event_payload_fn(event_payload) | ||
|
||
def try_publish_event_payload_batch(self, event_payload_batch: list[dict]) -> None: | ||
pass | ||
if self.try_publish_event_payload_batch_fn is not None: | ||
self.try_publish_event_payload_batch_fn(event_payload_batch) |
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