Ejemplo n.º 1
0
  /**
   * @param ref
   * @param message
   * @return
   */
  private HandleStatus deliverStandardMessage(
      SimpleString dest, final MessageReference ref, ServerMessage message) {
    // if we failover during send then there is a chance that the
    // that this will throw a disconnect, we need to remove the message
    // from the acks so it will get resent, duplicate detection will cope
    // with any messages resent

    if (logger.isTraceEnabled()) {
      logger.trace("going to send message: " + message + " from " + this.getQueue());
    }

    try {
      producer.send(dest, message);
    } catch (final ActiveMQException e) {
      ActiveMQServerLogger.LOGGER.bridgeUnableToSendMessage(e, ref);

      synchronized (refs) {
        // We remove this reference as we are returning busy which means the reference will never
        // leave the Queue.
        // because of this we have to remove the reference here
        refs.remove(message.getMessageID());

        // The delivering count should also be decreased as to avoid inconsistencies
        ((QueueImpl) ref.getQueue()).decDelivering();
      }

      connectionFailed(e, false);

      return HandleStatus.BUSY;
    }

    return HandleStatus.HANDLED;
  }
Ejemplo n.º 2
0
 @Override
 public void connectionFailed(final ActiveMQException me, boolean failedOver) {
   connectionFailed(me, failedOver, null);
 }