class_docstr: Pika-based event broker for publishing messages to RabbitMQ.
docstr: Publishes `event` to Pika queues.
  
  Args:
      event: Serialised event to be published.
      headers: Message headers to append to the published message. The headers
          can be retrieved in the consumer from the `headers` attribute of the
          message's `BasicProperties`.
docstr_tok: ["Publishes","`","event","`","to","Pika","queues",".","Args",":","event",":","Serialised","event","to","be","published",".","headers",":","Message","headers","to","append","to","the","published","message",".","The","headers","can","be","retrieved","in","the","consumer","from","the","`","headers","`","attribute","of","the","message","'s","`","BasicProperties","`","."]
code: def publish(
      self,
      event: Dict[Text, Any],
      headers: Optional[Dict[Text, Text]] = None,
  ) -> None:
      """Publishes `event` to Pika queues.
  
      Args:
          event: Serialised event to be published.
          headers: Message headers to append to the published message. The headers
              can be retrieved in the consumer from the `headers` attribute of the
              message's `BasicProperties`.
      """
      # We need to save a reference to this background task to
      # make sure it doesn't disappear. See:
      # https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
      task: asyncio.Task = self._loop.create_task(
          self._publish(event, headers)
      )
      self._background_tasks.add(task)
      task.add_done_callback(self._background_tasks.discard)
  
imports: import asyncio
  import json
  import logging
  import structlog
  import os
  import ssl
  from asyncio import AbstractEventLoop
  from collections import deque
  from typing import Deque, Dict, Optional, Text, Union, Any, List, Set, Tuple, cast
  from urllib.parse import urlparse
  import aio_pika
  from rasa.shared.exceptions import RasaException
  from rasa.shared.constants import DOCS_URL_PIKA_EVENT_BROKER
  from rasa.core.brokers.broker import EventBroker
  import rasa.shared.utils.io
  from rasa.utils.endpoints import EndpointConfig
  from rasa.shared.utils.io import DEFAULT_ENCODING
  import rasa.shared.utils.common
label_desc: Use image node_id 6 for calling the PikaEventBroker obj's underlying member method code with example usage: obj.publish(event, headers) without return types