Github user lahirus commented on a diff in the pull request: https://github.com/apache/stratos/pull/382#discussion_r36847922 --- Diff: components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/health/stat/CurveFinderOfLoadAverageMessageProcessor.java --- @@ -0,0 +1,44 @@ +package org.apache.stratos.messaging.message.processor.health.stat; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.messaging.event.health.stat.CurveFinderOfLoadAverageEvent; +import org.apache.stratos.messaging.message.processor.MessageProcessor; +import org.apache.stratos.messaging.util.MessagingUtil; + +/** + * Created by pranavan on 8/9/15. + */ +public class CurveFinderOfLoadAverageMessageProcessor extends MessageProcessor{ + private static final Log log = LogFactory.getLog(CurveFinderOfLoadAverageMessageProcessor.class); + private MessageProcessor nextProcessor; + + @Override + public void setNext(MessageProcessor nextProcessor) { + this.nextProcessor = nextProcessor; + } + + @Override + public boolean process(String type, String message, Object object) { + if (CurveFinderOfLoadAverageEvent.class.getName().equals(type)) { + + // Parse complete message and build event + CurveFinderOfLoadAverageEvent event = (CurveFinderOfLoadAverageEvent) MessagingUtil.jsonToObject + (message, CurveFinderOfLoadAverageEvent.class); + + // Notify event listeners + notifyEventListeners(event); + + if (log.isDebugEnabled()) { + log.debug(String.format("%s event processor notified listeners ... ", type)); + } + return true; + } else { + if (nextProcessor != null) { + return nextProcessor.process(type, message, object); + } else { + throw new RuntimeException(String.format("Failed to process health stat message using available message processors: [type] %s [body] %s", type, message)); --- End diff -- Have custom exceptions, not the RuntimeException
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---