Examples of ClusterMessagingService

  • org.apache.helix.ClusterMessagingService
    Provides the ability to
  • Send message to a specific component in the cluster[ participant, controller, Spectator(probably not needed) ]
  • Broadcast message to all participants
  • Send message to instances that hold a specific resource
  • Asynchronous request response api. Send message with a co-relation id and invoke a method when there is a response. Can support timeout.

  • Examples of com.linkedin.helix.ClusterMessagingService

          exceptionCaught = true;
        }
        AssertJUnit.assertTrue(exceptionCaught);

        // test message service
        ClusterMessagingService msgService = controller.getMessagingService();

        // test file management tool
        HelixAdmin tool = controller.getClusterManagmentTool();

        exceptionCaught = false;
    View Full Code Here

    Examples of com.linkedin.helix.ClusterMessagingService

        public void offlineToSlave(Message message, NotificationContext context)
        {
          System.out
              .println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
          HelixManager manager = context.getManager();
          ClusterMessagingService messagingService = manager.getMessagingService();
          Message requestBackupUriRequest = new Message(
              MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
          requestBackupUriRequest
              .setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
          requestBackupUriRequest.setMsgState(MessageState.NEW);
          Criteria recipientCriteria = new Criteria();
          recipientCriteria.setInstanceName("*");
          recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
          recipientCriteria.setResource(message.getResourceName());
          recipientCriteria.setPartition(message.getPartitionName());
          recipientCriteria.setSessionSpecific(true);
          // wait for 30 seconds
          int timeout = 30000;
          BootstrapReplyHandler responseHandler = new BootstrapReplyHandler();

          int sentMessageCount = messagingService.sendAndWait(recipientCriteria,
              requestBackupUriRequest, responseHandler, timeout);
          if (sentMessageCount == 0)
          {
            // could not find any other node hosting the partition
          } else if (responseHandler.getBootstrapUrl() != null)
    View Full Code Here

    Examples of org.apache.helix.ClusterMessagingService

        public void offlineToSlave(Message message, NotificationContext context)
        {
          System.out
              .println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
          HelixManager manager = context.getManager();
          ClusterMessagingService messagingService = manager.getMessagingService();
          Message requestBackupUriRequest = new Message(
              MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
          requestBackupUriRequest
              .setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
          requestBackupUriRequest.setMsgState(MessageState.NEW);
          Criteria recipientCriteria = new Criteria();
          recipientCriteria.setInstanceName("*");
          recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
          recipientCriteria.setResource(message.getResourceName());
          recipientCriteria.setPartition(message.getPartitionName());
          recipientCriteria.setSessionSpecific(true);
          // wait for 30 seconds
          int timeout = 30000;
          BootstrapReplyHandler responseHandler = new BootstrapReplyHandler();

          int sentMessageCount = messagingService.sendAndWait(recipientCriteria,
              requestBackupUriRequest, responseHandler, timeout);
          if (sentMessageCount == 0)
          {
            // could not find any other node hosting the partition
          } else if (responseHandler.getBootstrapUrl() != null)
    View Full Code Here

    Examples of org.apache.helix.ClusterMessagingService

        @Transition(from = "OFFLINE", to = "SLAVE")
        public void offlineToSlave(Message message, NotificationContext context) {
          System.out.println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
          HelixManager manager = context.getManager();
          ClusterMessagingService messagingService = manager.getMessagingService();
          Message requestBackupUriRequest =
              new Message(MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
          requestBackupUriRequest.setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
          requestBackupUriRequest.setMsgState(MessageState.NEW);
          Criteria recipientCriteria = new Criteria();
          recipientCriteria.setInstanceName("*");
          recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
          recipientCriteria.setResource(message.getResourceName());
          recipientCriteria.setPartition(message.getPartitionName());
          recipientCriteria.setSessionSpecific(true);
          // wait for 30 seconds
          int timeout = 30000;
          BootstrapReplyHandler responseHandler = new BootstrapReplyHandler();

          int sentMessageCount =
              messagingService.sendAndWait(recipientCriteria, requestBackupUriRequest, responseHandler,
                  timeout);
          if (sentMessageCount == 0) {
            // could not find any other node hosting the partition
          } else if (responseHandler.getBootstrapUrl() != null) {
            System.out.println("Got bootstrap url:" + responseHandler.getBootstrapUrl());
    View Full Code Here

    Examples of org.apache.helix.ClusterMessagingService

        @Transition(from = "OFFLINE", to = "SLAVE")
        public void offlineToSlave(Message message, NotificationContext context) {
          System.out.println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
          HelixManager manager = context.getManager();
          ClusterMessagingService messagingService = manager.getMessagingService();
          Message requestBackupUriRequest =
              new Message(MessageType.USER_DEFINE_MSG, MessageId.from(UUID.randomUUID().toString()));
          requestBackupUriRequest.setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
          requestBackupUriRequest.setMsgState(MessageState.NEW);
          Criteria recipientCriteria = new Criteria();
          recipientCriteria.setInstanceName("*");
          recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
          recipientCriteria.setResource(message.getResourceId().stringify());
          recipientCriteria.setPartition(message.getPartitionId().stringify());
          recipientCriteria.setSessionSpecific(true);
          // wait for 30 seconds
          int timeout = 30000;
          BootstrapReplyHandler responseHandler = new BootstrapReplyHandler();

          int sentMessageCount =
              messagingService.sendAndWait(recipientCriteria, requestBackupUriRequest, responseHandler,
                  timeout);
          if (sentMessageCount == 0) {
            // could not find any other node hosting the partition
          } else if (responseHandler.getBootstrapUrl() != null) {
            System.out.println("Got bootstrap url:" + responseHandler.getBootstrapUrl());
    View Full Code Here

    Examples of org.apache.helix.ClusterMessagingService

        @Transition(from = "OFFLINE", to = "SLAVE")
        public void offlineToSlave(Message message, NotificationContext context) {
          System.out.println("BootstrapProcess.BootstrapStateModel.offlineToSlave()");
          HelixManager manager = context.getManager();
          ClusterMessagingService messagingService = manager.getMessagingService();
          Message requestBackupUriRequest =
              new Message(MessageType.USER_DEFINE_MSG, MessageId.from(UUID.randomUUID().toString()));
          requestBackupUriRequest.setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
          requestBackupUriRequest.setMsgState(MessageState.NEW);
          Criteria recipientCriteria = new Criteria();
          recipientCriteria.setInstanceName("*");
          recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
          recipientCriteria.setResource(message.getResourceId().stringify());
          recipientCriteria.setPartition(message.getPartitionId().stringify());
          recipientCriteria.setSessionSpecific(true);
          // wait for 30 seconds
          int timeout = 30000;
          BootstrapReplyHandler responseHandler = new BootstrapReplyHandler();

          int sentMessageCount =
              messagingService.sendAndWait(recipientCriteria, requestBackupUriRequest, responseHandler,
                  timeout);
          if (sentMessageCount == 0) {
            // could not find any other node hosting the partition
          } else if (responseHandler.getBootstrapUrl() != null) {
            System.out.println("Got bootstrap url:" + responseHandler.getBootstrapUrl());
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.