@Override
  public void sendEvent(JetstreamEvent event) throws EventException {
    String key = JetstreamReservedKeys.EventReplayTopic.toString();

    if (event.containsKey(key)) {
      String retryTopic = (String) event.get(key);
      if (retryTopic != null && retryTopic.length() != 0) {
        retryTopic = "Replay-" + retryTopic.replaceAll("/", "-");
        event.setForwardingTopics(new String[] {retryTopic});
      }
    }

    super.sendEvent(event);
  }
  /*
   * (non-Javadoc)
   *
   * @see com.ebay.jetstream.messaging.JetstreamMessageListener#onMessage(com.ebay.jetstream.messaging.JetstreamMessage)
   */
  public void onMessage(JetstreamMessage m) {
    if (m instanceof AdvisoryMessage) {
      AdvisoryMessage advise = (AdvisoryMessage) m;

      if (advise.isStopSending()
          && matchesMyPublishingContexts(advise.getAdvisoryTopic().getRootContext())) {
        LOGGER.warn("Outbound Messaging Channel raising alarm");
        setTopicAlarmState(advise.getAdvisoryTopic().getRootContext());

        incrementAlarmsRaisedCounter();

        if (areAllContextsInAlarmCondition()) {
          m_alarmRaised.set(true);
          getAlarmListener().alarm(ChannelAlarm.OVERRUN);
          postAlert("All Contexts in Alarm Condition - ", AlertStrength.ORANGE);
        }
      } else if (advise.isResumeSending()
          && matchesMyPublishingContexts(advise.getAdvisoryTopic().getRootContext())) {
        LOGGER.info(
            "Outbound Messaging Channel clearing alarm for topic-> "
                + advise.getAdvisoryTopic().getRootContext());

        resetTopicAlarmState(advise.getAdvisoryTopic().getRootContext());

        if (!areAllContextsInAlarmCondition()) {
          m_alarmRaised.set(false);
          getAlarmListener().alarm(ChannelAlarm.CLEAR);
          postAlert("Alarm Condition Cleared - ", AlertStrength.YELLOW);
          incrementAlarmsClearedCounter();
        }
      } else if (advise.isResendMessage()) {

        JetstreamEvent evt =
            (JetstreamEvent) ((Any) ((AdvisoryMessage) m).getUndeliveredMsg()).getObject();

        try {
          evt = evt.clone();
        } catch (CloneNotSupportedException e) {
          m_errors.registerError(e);
          LOGGER.debug("Failed to clone event : Exception = " + e.getLocalizedMessage());
          this.incrementEventDroppedCounter();
          return;
        }

        List<String> topics = m_address.getChannelTopics();
        String topic = ((AdvisoryMessage) m).getAdvisoryTopic().toString();
        // Fix issue when multiple OMCs subscribe different topics under same context.
        // Each OMC will receive broadcast advisory events.
        if (topic == null || topics.contains(topic)) {
          evt.put(JetstreamReservedKeys.EventReplayTopic.toString(), topic);

          Integer retryCount = 1;
          if (evt != null) {
            if (evt.containsKey(JetstreamReservedKeys.RetryCount.toString())) {
              retryCount = (Integer) evt.get(JetstreamReservedKeys.RetryCount.toString());
              retryCount++;
            }
            evt.put(JetstreamReservedKeys.RetryCount.toString(), retryCount);
            sendToAdviceListener(
                evt, RetryEventCode.MSG_RETRY, AdvisoryCode.RESEND_MESSAGE.toString());
            incrementRetryAdvisoryEvents();
          }
        }
      }
    }
  }