Skip to content

Commit

Permalink
fix(pyrmq.consumer): add heartbeat kwargs for pika heartbeat config
Browse files Browse the repository at this point in the history
  • Loading branch information
zmdelima authored and alecgerona committed Nov 3, 2023
1 parent e1ec0db commit 317c8ee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyrmq/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(
:keyword bound_exchange: The exchange this consumer needs to bind to. This is an object that has two keys, ``name`` and ``type``. Default: ``None``
:keyword auto_ack: Flag whether to ack or nack the consumed message regardless of its outcome. Default: ``True``
:keyword prefetch_count: How many messages should the consumer retrieve at a time for consumption. Default: ``1``
:keyword heartbeat: Heartbeat seconds to wait for consumer process. Default: ``None``
"""

from pyrmq import Publisher
Expand Down Expand Up @@ -97,6 +98,7 @@ def __init__(
self.bound_exchange = kwargs.get("bound_exchange")
self.auto_ack = kwargs.get("auto_ack", True)
self.prefetch_count = kwargs.get("prefetch_count", 1)
self.heartbeat = kwargs.get("heartbeat", None)
self.channel = None
self.thread = None

Expand All @@ -106,6 +108,7 @@ def __init__(
credentials=PlainCredentials(self.username, self.password),
connection_attempts=self.connection_attempts,
retry_delay=self.retry_delay,
heartbeat=self.heartbeat,
)

self.retry_queue_name = f"{self.queue_name}.{self.retry_queue_suffix}"
Expand Down

0 comments on commit 317c8ee

Please sign in to comment.