@Override
  public boolean process(String type, String message, Object object) {
    Topology topology = (Topology) object;

    if (MemberMaintenanceModeEvent.class.getName().equals(type)) {
      // Return if topology has not been initialized
      if (!TopologyManager.isInitialized()) return false;

      // Parse complete message and build event
      MemberMaintenanceModeEvent event =
          (MemberMaintenanceModeEvent)
              MessagingUtil.jsonToObject(message, MemberMaintenanceModeEvent.class);

      TopologyUpdater.acquireWriteLockForCluster(event.getServiceName(), event.getClusterId());
      try {
        return doProcess(event, topology);

      } finally {
        TopologyUpdater.releaseWriteLockForCluster(event.getServiceName(), event.getClusterId());
      }

    } else {
      if (nextProcessor != null) {
        // ask the next processor to take care of the message.
        return nextProcessor.process(type, message, topology);
      } else {
        throw new RuntimeException(
            String.format(
                "Failed to process message using available message processors: [type] %s [body] %s",
                type, message));
      }
    }
  }
  private boolean doProcess(MemberMaintenanceModeEvent event, Topology topology) {

    String serviceName = event.getServiceName();
    String clusterId = event.getClusterId();

    // Apply service filter
    if (TopologyServiceFilter.apply(serviceName)) {
      return false;
    }

    // Apply cluster filter
    if (TopologyClusterFilter.apply(clusterId)) {
      return false;
    }

    // Validate event against the existing topology
    Service service = topology.getService(event.getServiceName());
    if (service == null) {
      if (log.isWarnEnabled()) {
        log.warn(String.format("Service does not exist: [service] %s", event.getServiceName()));
      }
      return false;
    }
    Cluster cluster = service.getCluster(event.getClusterId());
    if (cluster == null) {
      if (log.isWarnEnabled()) {
        log.warn(
            String.format(
                "Cluster does not exist: [service] %s [cluster] %s",
                event.getServiceName(), event.getClusterId()));
      }
      return false;
    }

    // Apply application filter
    if (TopologyApplicationFilter.apply(cluster.getAppId())) {
      return false;
    }

    Member member = cluster.getMember(event.getMemberId());
    if (member == null) {
      if (log.isWarnEnabled()) {
        log.warn(
            String.format(
                "Member does not exist: [service] %s [cluster] %s [member] %s",
                event.getServiceName(), event.getClusterId(), event.getMemberId()));
      }
      return false;
    }

    // Apply member filter
    if (TopologyMemberFilter.apply(member.getLbClusterId(), member.getNetworkPartitionId())) {
      return false;
    }

    if (member.getStatus() == MemberStatus.In_Maintenance) {
      if (log.isDebugEnabled()) {
        log.debug(
            String.format(
                "Member already updated as In_Maintenance: "
                    + "[service] %s [cluster] %s [member] %s",
                event.getServiceName(), event.getClusterId(), event.getMemberId()));
      }
    } else {

      // Apply changes to the topology
      if (!member.isStateTransitionValid(MemberStatus.In_Maintenance)) {
        log.error(
            "Invalid State Transition from "
                + member.getStatus()
                + " to "
                + MemberStatus.In_Maintenance);
      }
      member.setStatus(MemberStatus.In_Maintenance);

      if (log.isInfoEnabled()) {
        log.info(
            String.format(
                "Member updated as In_Maintenance: [service] %s [cluster] %s [member] %s",
                event.getServiceName(), event.getClusterId(), event.getMemberId()));
      }
    }

    // Notify event listeners
    notifyEventListeners(event);
    return true;
  }