org.apache.helix.model.Message.setMsgSubType()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(14.4k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中org.apache.helix.model.Message.setMsgSubType()方法的一些代码示例,展示了Message.setMsgSubType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setMsgSubType()方法的具体详情如下:
包路径:org.apache.helix.model.Message
类名称:Message
方法名:setMsgSubType

Message.setMsgSubType介绍

[英]Set a subtype of the message
[中]设置消息的子类型

代码示例

代码示例来源:origin: apache/incubator-gobblin

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.CONTROLLER);
  9. criteria.setSessionSpecific(true);
  10. Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  11. HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  12. shutdownRequest.setMsgSubType(HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString());
  13. shutdownRequest.setMsgState(Message.MessageState.NEW);
  14. shutdownRequest.setTgtSessionId("*");
  15. int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest);
  16. if (messagesSent == 0) {
  17. LOGGER.error(String.format("Failed to send the %s message to the controller", shutdownRequest.getMsgSubType()));
  18. }
  19. }

代码示例来源:origin: apache/incubator-gobblin

  1. tokenFileUpdatedMessage.setMsgSubType(HelixMessageSubTypes.TOKEN_FILE_UPDATED.toString());
  2. tokenFileUpdatedMessage.setMsgState(Message.MessageState.NEW);
  3. if (instanceType == InstanceType.CONTROLLER) {

代码示例来源:origin: apache/incubator-gobblin

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. final Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.CONTROLLER);
  9. criteria.setSessionSpecific(true);
  10. final Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  11. HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  12. shutdownRequest.setMsgSubType(HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString());
  13. shutdownRequest.setMsgState(Message.MessageState.NEW);
  14. shutdownRequest.setTgtSessionId("*");
  15. // Wait for 5 minutes
  16. final int timeout = 300000;
  17. // Send shutdown request to Cluster master, which will send shutdown request to workers
  18. // Upon receiving shutdown response from workers, master will shut itself down and call back shutdownASG()
  19. final int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest,
  20. shutdownASG(),timeout);
  21. if (messagesSent == 0) {
  22. LOGGER.error(String.format("Failed to send the %s message to the controller", shutdownRequest.getMsgSubType()));
  23. }
  24. }

代码示例来源:origin: apache/incubator-gobblin

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
  9. // #HELIX-0.6.7-WORKAROUND
  10. // Add this back when messaging to instances is ported to 0.6 branch
  11. //criteria.setDataSource(Criteria.DataSource.LIVEINSTANCES);
  12. criteria.setSessionSpecific(true);
  13. Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  14. HelixMessageSubTypes.WORK_UNIT_RUNNER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  15. shutdownRequest.setMsgSubType(HelixMessageSubTypes.WORK_UNIT_RUNNER_SHUTDOWN.toString());
  16. shutdownRequest.setMsgState(Message.MessageState.NEW);
  17. // Wait for 5 minutes
  18. final int timeout = 300000;
  19. // #HELIX-0.6.7-WORKAROUND
  20. // Temporarily bypass the default messaging service to allow upgrade to 0.6.7 which is missing support
  21. // for messaging to instances
  22. //int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest,
  23. // new NoopReplyHandler(), timeout);
  24. GobblinHelixMessagingService messagingService = new GobblinHelixMessagingService(this.multiManager.getJobClusterHelixManager());
  25. int messagesSent = messagingService.send(criteria, shutdownRequest,
  26. new NoopReplyHandler(), timeout);
  27. if (messagesSent == 0) {
  28. LOGGER.error(String.format("Failed to send the %s message to the participants", shutdownRequest.getMsgSubType()));
  29. }
  30. }

代码示例来源:origin: apache/incubator-gobblin

  1. @VisibleForTesting
  2. public static void sendUserDefinedMessage(String messageSubType, String messageVal, String messageId,
  3. InstanceType instanceType, HelixManager helixManager, Logger logger) {
  4. Criteria criteria = new Criteria();
  5. criteria.setInstanceName("%");
  6. criteria.setResource("%");
  7. criteria.setPartition("%");
  8. criteria.setPartitionState("%");
  9. criteria.setRecipientInstanceType(instanceType);
  10. criteria.setSessionSpecific(true);
  11. Message message = new Message(Message.MessageType.USER_DEFINE_MSG.toString(), messageId);
  12. message.setMsgSubType(messageSubType);
  13. message.setAttribute(Message.Attributes.INNER_MESSAGE, messageVal);
  14. message.setMsgState(Message.MessageState.NEW);
  15. message.setTgtSessionId("*");
  16. int messagesSent = helixManager.getMessagingService().send(criteria, message);
  17. if (messagesSent == 0) {
  18. logger.error(String.format("Failed to send the %s message to the participants", message));
  19. }
  20. }
  21. }

代码示例来源:origin: org.apache.gobblin/gobblin-yarn

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.CONTROLLER);
  9. criteria.setSessionSpecific(true);
  10. Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  11. HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  12. shutdownRequest.setMsgSubType(HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString());
  13. shutdownRequest.setMsgState(Message.MessageState.NEW);
  14. shutdownRequest.setTgtSessionId("*");
  15. int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest);
  16. if (messagesSent == 0) {
  17. LOGGER.error(String.format("Failed to send the %s message to the controller", shutdownRequest.getMsgSubType()));
  18. }
  19. }

代码示例来源:origin: com.linkedin.gobblin/gobblin-aws

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. final Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.CONTROLLER);
  9. criteria.setSessionSpecific(true);
  10. final Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  11. HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  12. shutdownRequest.setMsgSubType(HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString());
  13. shutdownRequest.setMsgState(Message.MessageState.NEW);
  14. shutdownRequest.setTgtSessionId("*");
  15. // Wait for 5 minutes
  16. final int timeout = 300000;
  17. // Send shutdown request to Cluster master, which will send shutdown request to workers
  18. // Upon receiving shutdown response from workers, master will shut itself down and call back shutdownASG()
  19. final int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest,
  20. shutdownASG(),timeout);
  21. if (messagesSent == 0) {
  22. LOGGER.error(String.format("Failed to send the %s message to the controller", shutdownRequest.getMsgSubType()));
  23. }
  24. }

代码示例来源:origin: com.linkedin.gobblin/gobblin-cluster

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
  9. // #HELIX-0.6.7-WORKAROUND
  10. // Add this back when messaging to instances is ported to 0.6 branch
  11. //criteria.setDataSource(Criteria.DataSource.LIVEINSTANCES);
  12. criteria.setSessionSpecific(true);
  13. Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  14. HelixMessageSubTypes.WORK_UNIT_RUNNER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  15. shutdownRequest.setMsgSubType(HelixMessageSubTypes.WORK_UNIT_RUNNER_SHUTDOWN.toString());
  16. shutdownRequest.setMsgState(Message.MessageState.NEW);
  17. // Wait for 5 minutes
  18. final int timeout = 300000;
  19. // #HELIX-0.6.7-WORKAROUND
  20. // Temporarily bypass the default messaging service to allow upgrade to 0.6.7 which is missing support
  21. // for messaging to instances
  22. //int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest,
  23. // new NoopReplyHandler(), timeout);
  24. GobblinHelixMessagingService messagingService = new GobblinHelixMessagingService(this.helixManager);
  25. int messagesSent = messagingService.send(criteria, shutdownRequest,
  26. new NoopReplyHandler(), timeout);
  27. if (messagesSent == 0) {
  28. LOGGER.error(String.format("Failed to send the %s message to the participants", shutdownRequest.getMsgSubType()));
  29. }
  30. }

代码示例来源:origin: org.apache.gobblin/gobblin-aws

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. final Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.CONTROLLER);
  9. criteria.setSessionSpecific(true);
  10. final Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  11. HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  12. shutdownRequest.setMsgSubType(HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString());
  13. shutdownRequest.setMsgState(Message.MessageState.NEW);
  14. shutdownRequest.setTgtSessionId("*");
  15. // Wait for 5 minutes
  16. final int timeout = 300000;
  17. // Send shutdown request to Cluster master, which will send shutdown request to workers
  18. // Upon receiving shutdown response from workers, master will shut itself down and call back shutdownASG()
  19. final int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest,
  20. shutdownASG(),timeout);
  21. if (messagesSent == 0) {
  22. LOGGER.error(String.format("Failed to send the %s message to the controller", shutdownRequest.getMsgSubType()));
  23. }
  24. }

代码示例来源:origin: org.apache.gobblin/gobblin-yarn

  1. tokenFileUpdatedMessage.setMsgSubType(HelixMessageSubTypes.TOKEN_FILE_UPDATED.toString());
  2. tokenFileUpdatedMessage.setMsgState(Message.MessageState.NEW);
  3. if (instanceType == InstanceType.CONTROLLER) {

代码示例来源:origin: org.apache.gobblin/gobblin-cluster

  1. @VisibleForTesting
  2. void sendShutdownRequest() {
  3. Criteria criteria = new Criteria();
  4. criteria.setInstanceName("%");
  5. criteria.setResource("%");
  6. criteria.setPartition("%");
  7. criteria.setPartitionState("%");
  8. criteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
  9. // #HELIX-0.6.7-WORKAROUND
  10. // Add this back when messaging to instances is ported to 0.6 branch
  11. //criteria.setDataSource(Criteria.DataSource.LIVEINSTANCES);
  12. criteria.setSessionSpecific(true);
  13. Message shutdownRequest = new Message(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE,
  14. HelixMessageSubTypes.WORK_UNIT_RUNNER_SHUTDOWN.toString().toLowerCase() + UUID.randomUUID().toString());
  15. shutdownRequest.setMsgSubType(HelixMessageSubTypes.WORK_UNIT_RUNNER_SHUTDOWN.toString());
  16. shutdownRequest.setMsgState(Message.MessageState.NEW);
  17. // Wait for 5 minutes
  18. final int timeout = 300000;
  19. // #HELIX-0.6.7-WORKAROUND
  20. // Temporarily bypass the default messaging service to allow upgrade to 0.6.7 which is missing support
  21. // for messaging to instances
  22. //int messagesSent = this.helixManager.getMessagingService().send(criteria, shutdownRequest,
  23. // new NoopReplyHandler(), timeout);
  24. GobblinHelixMessagingService messagingService = new GobblinHelixMessagingService(this.multiManager.getJobClusterHelixManager());
  25. int messagesSent = messagingService.send(criteria, shutdownRequest,
  26. new NoopReplyHandler(), timeout);
  27. if (messagesSent == 0) {
  28. LOGGER.error(String.format("Failed to send the %s message to the participants", shutdownRequest.getMsgSubType()));
  29. }
  30. }

代码示例来源:origin: com.linkedin.gobblin/gobblin-service

  1. @VisibleForTesting
  2. public static void sendUserDefinedMessage(String messageSubType, String messageVal, String messageId,
  3. InstanceType instanceType, HelixManager helixManager, Logger logger) {
  4. Criteria criteria = new Criteria();
  5. criteria.setInstanceName("%");
  6. criteria.setResource("%");
  7. criteria.setPartition("%");
  8. criteria.setPartitionState("%");
  9. criteria.setRecipientInstanceType(instanceType);
  10. criteria.setSessionSpecific(true);
  11. Message message = new Message(Message.MessageType.USER_DEFINE_MSG.toString(), messageId);
  12. message.setMsgSubType(messageSubType);
  13. message.setAttribute(Message.Attributes.INNER_MESSAGE, messageVal);
  14. message.setMsgState(Message.MessageState.NEW);
  15. message.setTgtSessionId("*");
  16. int messagesSent = helixManager.getMessagingService().send(criteria, message);
  17. if (messagesSent == 0) {
  18. logger.error(String.format("Failed to send the %s message to the participants", message));
  19. }
  20. }
  21. }

代码示例来源:origin: org.apache.helix/helix-core

  1. Message requestBackupUriRequest =
  2. new Message(MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
  3. requestBackupUriRequest.setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
  4. requestBackupUriRequest.setMsgState(MessageState.NEW);
  5. Criteria recipientCriteria = new Criteria();

代码示例来源:origin: org.apache.gobblin/gobblin-service

  1. @VisibleForTesting
  2. public static void sendUserDefinedMessage(String messageSubType, String messageVal, String messageId,
  3. InstanceType instanceType, HelixManager helixManager, Logger logger) {
  4. Criteria criteria = new Criteria();
  5. criteria.setInstanceName("%");
  6. criteria.setResource("%");
  7. criteria.setPartition("%");
  8. criteria.setPartitionState("%");
  9. criteria.setRecipientInstanceType(instanceType);
  10. criteria.setSessionSpecific(true);
  11. Message message = new Message(Message.MessageType.USER_DEFINE_MSG.toString(), messageId);
  12. message.setMsgSubType(messageSubType);
  13. message.setAttribute(Message.Attributes.INNER_MESSAGE, messageVal);
  14. message.setMsgState(Message.MessageState.NEW);
  15. message.setTgtSessionId("*");
  16. int messagesSent = helixManager.getMessagingService().send(criteria, message);
  17. if (messagesSent == 0) {
  18. logger.error(String.format("Failed to send the %s message to the participants", message));
  19. }
  20. }
  21. }

代码示例来源:origin: apache/helix

  1. Message requestBackupUriRequest =
  2. new Message(MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
  3. requestBackupUriRequest.setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL);
  4. requestBackupUriRequest.setMsgState(MessageState.NEW);
  5. Criteria recipientCriteria = new Criteria();

代码示例来源:origin: apache/helix

  1. exceptionMsg.setMsgSubType("EXCEPTION");
  2. exceptionMsg.setTgtName("Localhost_1123");
  3. exceptionMsg.setSrcName("127.101.1.23_2234");

相关文章