code: public void publish(Channel channel, DeliveryOptions deliveryOptions) throws IOException {
          // Assure to have a timestamp
          if (basicProperties.getTimestamp() == null) {
              basicProperties.builder().timestamp(new Date());
          }
  
          boolean mandatory = deliveryOptions == DeliveryOptions.MANDATORY;
          boolean immediate = deliveryOptions == DeliveryOptions.IMMEDIATE;
  
          LOGGER.info("Publishing message to exchange '{}' with routing key '{}' (deliveryOptions: {}, persistent: {})",
                  new Object[] { exchange, routingKey, deliveryOptions, basicProperties.getDeliveryMode() == 2 });
  
          channel.basicPublish(exchange, routingKey, mandatory, immediate, basicProperties, bodyContent);
          LOGGER.info("Successfully published message to exchange '{}' with routing key '{}'", exchange, routingKey);
      }
docs: Publishes a message via the given channel while using the specified delivery options.
  
  @param channel The channel used to publish the message on
  @param deliveryOptions The delivery options to use
  @throws IOException