| 1 |
""" |
| 2 |
AMQP Heartbeat Frame, used to create new Heartbeat frames for sending to a peer |
| 3 |
|
| 4 |
""" |
| 5 |
|
| 6 |
import struct |
| 7 |
import typing |
| 8 |
|
| 9 |
from pamqp import constants |
| 10 |
|
| 11 |
|
| 12 |
class Heartbeat: |
| 13 |
"""Heartbeat frame object mapping class. AMQP Heartbeat frames are mapped |
| 14 |
on to this class for a common access structure to the attributes/data |
| 15 |
values. |
| 16 |
|
| 17 |
""" |
| 18 |
|
| 19 |
name: typing.ClassVar[str] = 'Heartbeat' |
| 20 |
value: typing.ClassVar[bytes] = ( |
| 21 |
struct.pack('>BHI', constants.FRAME_HEARTBEAT, 0, 0) |
| 22 |
+ constants.FRAME_END_CHAR |
| 23 |
) |
| 24 |
|
| 25 |
@classmethod |
| 26 |
def marshal(cls) -> bytes: |
| 27 |
"""Return the binary frame content""" |
| 28 |
return cls.value |