CounterWatcher
faststream.broker.push_back_watcher.CounterWatcher #
Bases: BaseWatcher
A class to watch and track the count of messages.
PARAMETER | DESCRIPTION |
---|---|
max_tries | int - maximum number of tries allowed DEFAULT: |
logger | Optional[Logger] - logger object for logging messages DEFAULT: |
METHOD | DESCRIPTION |
---|---|
add | str) -> None - adds a message to the counter |
is_max | str) -> bool - checks if the count of a message has reached the maximum tries |
remove | str) -> None - removes a message from the counter |
Initialize the class.
PARAMETER | DESCRIPTION |
---|---|
max_tries | maximum number of tries TYPE: |
logger | logger object (default: None) |
Source code in faststream/broker/push_back_watcher.py
add #
add(message_id: str) -> None
Increments the count of a message in the memory.
PARAMETER | DESCRIPTION |
---|---|
message_id | The ID of the message to be incremented. TYPE: |
RETURNS | DESCRIPTION |
---|---|
None | None |
is_max #
Check if the number of tries for a message has exceeded the maximum allowed tries.
PARAMETER | DESCRIPTION |
---|---|
message_id | The ID of the message TYPE: |
RETURNS | DESCRIPTION |
---|---|
bool | True if the number of tries has exceeded the maximum allowed tries, False otherwise |