RabbitPublisher
faststream.rabbit.publisher.RabbitPublisher #
RabbitPublisher(
config: RabbitPublisherConfig,
specification: PublisherSpecification[Any, Any],
)
Bases: PublisherUsecase
A class to represent a RabbitMQ publisher.
Source code in faststream/rabbit/publisher/usecase.py
mock property #
The mock recording the endpoint's calls, available under a test broker.
assert_called_once_with async #
assert_called_once_with(
body: Any = EMPTY,
/,
*,
headers: Any = EMPTY,
correlation_id: Any = EMPTY,
reply_to: Any = EMPTY,
content_type: Any = EMPTY,
path: Any = EMPTY,
context: Mapping[str, Any] = EMPTY,
) -> None
Assert the endpoint was called once, with the message described here.
| PARAMETER | DESCRIPTION |
|---|---|
body | The body as a dict, a model or a matcher; it goes through the codec. TYPE: |
headers | Headers the message must carry; the rest may carry more. TYPE: |
correlation_id | The exact correlation id. TYPE: |
reply_to | The exact reply-to destination. TYPE: |
content_type | The exact content type. TYPE: |
path | The exact path parameters the subject template matched. TYPE: |
context | Context paths, as given to TYPE: |
Source code in faststream/_internal/testing/calls.py
assert_called_with async #
assert_called_with(
body: Any = EMPTY,
/,
*,
headers: Any = EMPTY,
correlation_id: Any = EMPTY,
reply_to: Any = EMPTY,
content_type: Any = EMPTY,
path: Any = EMPTY,
context: Mapping[str, Any] = EMPTY,
) -> None
Assert the last message the endpoint saw is the one described here.
| PARAMETER | DESCRIPTION |
|---|---|
body | The body as a dict, a model or a matcher; it goes through the codec. TYPE: |
headers | Headers the message must carry; the rest may carry more. TYPE: |
correlation_id | The exact correlation id. TYPE: |
reply_to | The exact reply-to destination. TYPE: |
content_type | The exact content type. TYPE: |
path | The exact path parameters the subject template matched. TYPE: |
context | Context paths, as given to TYPE: |
Source code in faststream/_internal/testing/calls.py
assert_any_call async #
assert_any_call(
body: Any = EMPTY,
/,
*,
headers: Any = EMPTY,
correlation_id: Any = EMPTY,
reply_to: Any = EMPTY,
content_type: Any = EMPTY,
path: Any = EMPTY,
context: Mapping[str, Any] = EMPTY,
) -> None
Assert one of the messages the endpoint saw is the one described here.
| PARAMETER | DESCRIPTION |
|---|---|
body | The body as a dict, a model or a matcher; it goes through the codec. TYPE: |
headers | Headers the message must carry; the rest may carry more. TYPE: |
correlation_id | The exact correlation id. TYPE: |
reply_to | The exact reply-to destination. TYPE: |
content_type | The exact content type. TYPE: |
path | The exact path parameters the subject template matched. TYPE: |
context | Context paths, as given to TYPE: |
Source code in faststream/_internal/testing/calls.py
set_test #
Turn publisher to testing mode, sharing recorder when one is given.
Source code in faststream/_internal/endpoint/publisher/usecase.py
reset_test #
Turn off publisher's testing mode.
Source code in faststream/_internal/endpoint/publisher/usecase.py
schema #
schema() -> dict[str, PublisherSpec]
routing #
routing(
*,
queue: Union[RabbitQueue, str, None] = None,
routing_key: str = "",
) -> str
Source code in faststream/rabbit/publisher/usecase.py
start async #
publish async #
publish(
message: AioPikaSendableMessage,
queue: Union[RabbitQueue, str, None] = None,
exchange: Union[RabbitExchange, str, None] = None,
*,
routing_key: str = "",
**publish_kwargs: Unpack[PublishKwargs],
) -> Optional[ConfirmationFrameType]
Source code in faststream/rabbit/publisher/usecase.py
request async #
request(
message: AioPikaSendableMessage,
queue: Union[RabbitQueue, str, None] = None,
exchange: Union[RabbitExchange, str, None] = None,
*,
routing_key: str = "",
**publish_kwargs: Unpack[PublishKwargs],
) -> RabbitMessage