Publish to the channel with the given exchange, routing key and body. For more information on basic_publish and what the parameters do, see: https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish :param str exchange: The exchange to publish to :param str r
(self,
exchange: str,
routing_key: str,
body: bytes,
properties: Optional[spec.BasicProperties] = None,
mandatory: bool = False)
| 460 | spec.Basic.Nack(delivery_tag, multiple, requeue)) |
| 461 | |
| 462 | def basic_publish(self, |
| 463 | exchange: str, |
| 464 | routing_key: str, |
| 465 | body: bytes, |
| 466 | properties: Optional[spec.BasicProperties] = None, |
| 467 | mandatory: bool = False) -> None: |
| 468 | """Publish to the channel with the given exchange, routing key and body. |
| 469 | For more information on basic_publish and what the parameters do, see: |
| 470 | |
| 471 | https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish |
| 472 | |
| 473 | :param str exchange: The exchange to publish to |
| 474 | :param str routing_key: The routing key to bind on |
| 475 | :param bytes body: The message body |
| 476 | :param pika.spec.BasicProperties properties: Basic.properties |
| 477 | :param bool mandatory: The mandatory flag |
| 478 | |
| 479 | """ |
| 480 | self._raise_if_not_open() |
| 481 | body = as_bytes(body) |
| 482 | properties = properties or spec.BasicProperties() |
| 483 | self._send_method( |
| 484 | spec.Basic.Publish(exchange=exchange, |
| 485 | routing_key=routing_key, |
| 486 | mandatory=mandatory), (properties, body)) |
| 487 | |
| 488 | def basic_qos(self, |
| 489 | prefetch_size: int = 0, |