Skip to content

MockConfluentMessage

faststream.confluent.testing.MockConfluentMessage #

MockConfluentMessage(
    raw_msg: bytes,
    topic: str,
    key: bytes | str,
    headers: list[tuple[str, bytes]],
    offset: int,
    partition: int,
    timestamp_type: int,
    timestamp_ms: int,
    error: str | None = None,
)
Source code in faststream/confluent/testing.py
def __init__(
    self,
    raw_msg: bytes,
    topic: str,
    key: bytes | str,
    headers: list[tuple[str, bytes]],
    offset: int,
    partition: int,
    timestamp_type: int,
    timestamp_ms: int,
    error: str | None = None,
) -> None:
    self._raw_msg = raw_msg
    self._topic = topic

    if isinstance(key, str):
        self._key = key.encode()
    else:
        self._key = key

    self._headers = headers
    self._error = error
    self._offset = offset
    self._partition = partition
    self._timestamp = (timestamp_type, timestamp_ms)

len #

len() -> int
Source code in faststream/confluent/testing.py
def len(self) -> int:
    return len(self._raw_msg)

error #

error() -> str | None
Source code in faststream/confluent/testing.py
def error(self) -> str | None:
    return self._error

headers #

headers() -> list[tuple[str, bytes]]
Source code in faststream/confluent/testing.py
def headers(self) -> list[tuple[str, bytes]]:
    return self._headers

key #

key() -> bytes
Source code in faststream/confluent/testing.py
def key(self) -> bytes:
    return self._key

offset #

offset() -> int
Source code in faststream/confluent/testing.py
def offset(self) -> int:
    return self._offset

partition #

partition() -> int
Source code in faststream/confluent/testing.py
def partition(self) -> int:
    return self._partition

timestamp #

timestamp() -> tuple[int, int]
Source code in faststream/confluent/testing.py
def timestamp(self) -> tuple[int, int]:
    return self._timestamp

topic #

topic() -> str
Source code in faststream/confluent/testing.py
def topic(self) -> str:
    return self._topic

value #

value() -> bytes
Source code in faststream/confluent/testing.py
def value(self) -> bytes:
    return self._raw_msg