MockConfluentMessage(
raw_msg: bytes | None,
topic: str,
key: bytes | str,
headers: Sequence[tuple[str, str | bytes | None]],
offset: int,
partition: int,
timestamp_type: int,
timestamp_ms: int,
error: KafkaError | None = None,
)
Bases: Message
The message the in-memory broker delivers, answering as the client's does.
Source code in faststream/confluent/testing.py
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322 | def __init__(
self,
raw_msg: bytes | None,
topic: str,
key: bytes | str,
headers: Sequence[tuple[str, str | bytes | None]],
offset: int,
partition: int,
timestamp_type: int,
timestamp_ms: int,
error: KafkaError | 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 = list(headers)
self._error = error
self._offset = offset
self._partition = partition
self._timestamp = (timestamp_type, timestamp_ms)
|
len
Source code in faststream/confluent/testing.py
| def len(self) -> int:
return 0 if self._raw_msg is None else len(self._raw_msg)
|
error
error() -> KafkaError | None
Source code in faststream/confluent/testing.py
| def error(self) -> KafkaError | None:
return self._error
|
headers() -> list[tuple[str, str | bytes | None]]
Source code in faststream/confluent/testing.py
| def headers(self) -> list[tuple[str, str | bytes | None]]:
return self._headers
|
key
Source code in faststream/confluent/testing.py
| def key(self) -> bytes:
return self._key
|
offset
Source code in faststream/confluent/testing.py
| def offset(self) -> int:
return self._offset
|
partition
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
Source code in faststream/confluent/testing.py
| def topic(self) -> str:
return self._topic
|
value
Source code in faststream/confluent/testing.py
| def value(self) -> bytes | None:
return self._raw_msg
|