class_docstr: This publisher will handle failures and closures and will
  attempt to restart things
  
  delivery confirmations are used to track messages that have
  been sent and if they have been confirmed
docstr: Publish a message to RMQ, appending a list of deliveries with
  the message number that was sent.  This list will be used to
  check for delivery confirmations in the
  on_delivery_confirmations method.
docstr_tok: ["Publish","a","message","to","RMQ",",","appending","a","list","of","deliveries","with","the","message","number","that","was","sent",".","This","list","will","be","used","to","check","for","delivery","confirmations","in","the","on_delivery_confirmations","method","."]
code: def enqueue(self, msg, retries=10):
      """
      Publish a message to RMQ, appending a list of deliveries with
      the message number that was sent.  This list will be used to
      check for delivery confirmations in the
      on_delivery_confirmations method.
      """
      if self._url is None:
          raise Exception("url for rmq not initialized")
  
      if msg is None:
          raise Exception(
              "message was None, it needs a meaningful value to be sent"
          )
  
      # Wait to see if the channel gets opened
      tries = retries
      while tries != 0:
          if self._channel is None:
              self._logger.warning(
                  "failed to send message (%s tries left) to %s as "
                  "the channel API was not initialized",
                  tries,
                  self._url,
              )
          elif not self._channel.is_open:
              self._logger.warning(
                  "failed to send message (%s tries left) to %s as "
                  "the channel was not open",
                  tries,
                  self._url,
              )
          elif self._queue_deleted:
              self._logger.warning(
                  "failed to send message (%s tries left) to %s as "
                  "the queue is not yet created",
                  tries,
                  self._url,
              )
          else:
              break
  
          time.sleep(1)
          tries -= 1
  
      if tries == 0:
          raise Exception("studioml request could not be sent")
  
      self._logger.debug("sending message %s to %s ", msg, self._url)
      if self._is_persistent:
          properties = pika.BasicProperties(
              app_id="studioml",
              delivery_mode=2,  # make message persistent
              content_type="application/json",
          )
      else:
          properties = pika.BasicProperties(
              app_id="studioml", content_type="application/json"
          )
  
      self._channel.basic_publish(
          exchange=self._exchange,
          routing_key=self._routing_key,
          body=msg,
          properties=properties,
          mandatory=True,
      )
      self._logger.debug("sent message to %s ", self._url)
  
      with self._msg_tracking_lock:
          self._message_number += 1
  
          message_number = self._message_number
          self._deliveries.append(self._message_number)
  
      tries = retries
      while tries != 0:
          time.sleep(1)
  
          with self._msg_tracking_lock:
              if message_number not in self._deliveries:
                  self._logger.info(
                      "sent message acknowledged to %s after waiting %s seconds",
                      self._url,
                      retries - tries + 1,
                  )
  
                  return message_number
              tries -= 1
  
      msg: str = (
          "studioml message {0} was never acknowledged to {1} "
          + "after waiting {2} seconds"
      ).format(message_number, self._url, retries)
      raise Exception(msg)
  
imports: import time
  import threading
  import pika
  from studio.storage.storage_setup import get_storage_verbose_level
  from studio.util import logs
label_desc: Use image node_id 29 for calling the RMQueue obj's underlying member method code with example usage: obj.enqueue(msg, retries) and returns: message_number