@Override
 public void broadcast(
     final String serviceId, final MessageType type, final Map<String, String> content) {
   participantManager
       .getMessagingService()
       .send(buildCriteria(), buildMessage(serviceId, type, content));
 }
  @Override
  public void broadcast(
      final String serviceId,
      final MessageType type,
      final Map<String, String> content,
      final int timeOut,
      final AsyncCallback callback) {
    participantManager
        .getMessagingService()
        .send(
            buildCriteria(),
            buildMessage(serviceId, type, content),
            new org.apache.helix.messaging.AsyncCallback() {
              @Override
              public void onTimeOut() {
                callback.onTimeOut();
              }

              @Override
              public void onReplyMessage(final Message message) {
                final MessageType type = buildMessageTypeFromReply(message);
                final Map<String, String> map = getMessageContent(message);

                callback.onReply(type, map);
              }
            },
            timeOut);
  }
 void start() {
   try {
     participantManager
         .getMessagingService()
         .registerMessageHandlerFactory(
             Message.MessageType.USER_DEFINE_MSG.toString(),
             new MessageHandlerResolverWrapper().convert());
     participantManager
         .getStateMachineEngine()
         .registerStateModelFactory("LeaderStandby", new LockTransitionalFactory());
     participantManager.connect();
     offlinePartition();
   } catch (final Exception ex) {
     throw new RuntimeException(ex);
   }
 }
  @Override
  public void broadcastAndWait(
      final String serviceId,
      final MessageType type,
      final Map<String, String> content,
      int timeOut) {
    participantManager
        .getMessagingService()
        .sendAndWait(
            buildCriteria(),
            buildMessage(serviceId, type, content),
            new org.apache.helix.messaging.AsyncCallback(timeOut) {
              @Override
              public void onTimeOut() {}

              @Override
              public void onReplyMessage(final Message message) {}
            },
            timeOut);
  }