docs: protected void beforeDelivery(final SIBusMessage message, MessageEndpoint endpoint)
              throws ResourceException
      {
          final String methodName = "beforeDelivery";
          if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
          {
              SibTr.entry(this, TRACE, methodName, message);
          }
  
          // This will call before delivery on the endpoint
          beforeDelivery (endpoint);
  
          try
          {
              // If we are enlisted in the xa transaction then delete the message
              // under that transaction.
              if ((_xaResource != null) && (_xaResource.isEnlisted ()))
              {
                  if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ())
                  {
                      SibTr.debug(this, TRACE, "Deleting the message under the xa transaction (Message=" + message + ") (xaResource=" + _xaResource);
                  }
  
                  deleteMessage(message, _xaResource);
              }
              else
              {
                  // If we have not been enlisted then we can assume that we have
                  // inherited the transaction from the local thread which was imported
                  // from the message itself. As such we can not delete the message
                  // under this transaction because if the message rolls back the message
                  // will be redelivered and we can not reuse the same transaction since
                  // it is no longer a valid transaction. Once the transaction has been
                  // imported then the message has done its "work" and we can auto commit
                  // the deletion.
                  if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ())
                  {
                      SibTr.debug(this, TRACE, "xaResource is either null or is not enlisted so deleting the message non transactional (auto commit) (Message=" + message + ")");
                  }
  
                  deleteMessage(message, null);
              }
          }
          catch (final ResourceException exception)
          {
              FFDCFilter.processException(exception, CLASS_NAME + "."
                      + methodName, FFDC_PROBE_4, this);
  
              endpoint.afterDelivery();
  
              throw exception;
          }
  
          if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
          {
              SibTr.exit(this, TRACE, methodName);
          }
      }