Java Code Examples for org.apache.helix.ClusterMessagingService#send()
The following examples show how to use
org.apache.helix.ClusterMessagingService#send() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PinotHelixResourceManager.java From incubator-pinot with Apache License 2.0 | 6 votes |
public int reloadAllSegments(String tableNameWithType) { LOGGER.info("Sending reload message for table: {}", tableNameWithType); Criteria recipientCriteria = new Criteria(); recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT); recipientCriteria.setInstanceName("%"); recipientCriteria.setResource(tableNameWithType); recipientCriteria.setSessionSpecific(true); SegmentReloadMessage segmentReloadMessage = new SegmentReloadMessage(tableNameWithType, null); ClusterMessagingService messagingService = _helixZkManager.getMessagingService(); // Infinite timeout on the recipient int timeoutMs = -1; int numMessagesSent = messagingService.send(recipientCriteria, segmentReloadMessage, null, timeoutMs); if (numMessagesSent > 0) { LOGGER.info("Sent {} reload messages for table: {}", numMessagesSent, tableNameWithType); } else { LOGGER.warn("No reload message sent for table: {}", tableNameWithType); } return numMessagesSent; }
Example 2
Source File: PinotHelixResourceManager.java From incubator-pinot with Apache License 2.0 | 6 votes |
public int reloadSegment(String tableNameWithType, String segmentName) { LOGGER.info("Sending reload message for segment: {} in table: {}", segmentName, tableNameWithType); Criteria recipientCriteria = new Criteria(); recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT); recipientCriteria.setInstanceName("%"); recipientCriteria.setResource(tableNameWithType); recipientCriteria.setPartition(segmentName); recipientCriteria.setSessionSpecific(true); SegmentReloadMessage segmentReloadMessage = new SegmentReloadMessage(tableNameWithType, segmentName); ClusterMessagingService messagingService = _helixZkManager.getMessagingService(); // Infinite timeout on the recipient int timeoutMs = -1; int numMessagesSent = messagingService.send(recipientCriteria, segmentReloadMessage, null, timeoutMs); if (numMessagesSent > 0) { LOGGER.info("Sent {} reload messages for segment: {} in table: {}", numMessagesSent, segmentName, tableNameWithType); } else { LOGGER.warn("No reload message sent for segment: {} in table: {}", segmentName, tableNameWithType); } return numMessagesSent; }
Example 3
Source File: PinotHelixResourceManager.java From incubator-pinot with Apache License 2.0 | 5 votes |
/** * Attempt to send a message to refresh the new segment. We do not wait for any acknowledgements. * The message is sent as session-specific, so if a new zk session is created (e.g. server restarts) * it will not get the message. */ private void sendSegmentRefreshMessage(String offlineTableName, String segmentName) { SegmentRefreshMessage segmentRefreshMessage = new SegmentRefreshMessage(offlineTableName, segmentName); // Send segment refresh message to servers Criteria recipientCriteria = new Criteria(); recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT); recipientCriteria.setInstanceName("%"); recipientCriteria.setResource(offlineTableName); recipientCriteria.setPartition(segmentName); recipientCriteria.setSessionSpecific(true); ClusterMessagingService messagingService = _helixZkManager.getMessagingService(); // Send message with no callback and infinite timeout on the recipient int numMessagesSent = messagingService.send(recipientCriteria, segmentRefreshMessage, null, -1); if (numMessagesSent > 0) { // TODO: Would be nice if we can get the name of the instances to which messages were sent LOGGER.info("Sent {} segment refresh messages to servers for segment: {} of table: {}", numMessagesSent, segmentName, offlineTableName); } else { // May be the case when none of the servers are up yet. That is OK, because when they come up they will get the // new version of the segment. LOGGER.warn("No segment refresh message sent to servers for segment: {} of table: {}", segmentName, offlineTableName); } // Send segment refresh message to brokers recipientCriteria.setResource(Helix.BROKER_RESOURCE_INSTANCE); recipientCriteria.setPartition(offlineTableName); numMessagesSent = messagingService.send(recipientCriteria, segmentRefreshMessage, null, -1); if (numMessagesSent > 0) { // TODO: Would be nice if we can get the name of the instances to which messages were sent LOGGER.info("Sent {} segment refresh messages to brokers for segment: {} of table: {}", numMessagesSent, segmentName, offlineTableName); } else { LOGGER.warn("No segment refresh message sent to brokers for segment: {} of table: {}", segmentName, offlineTableName); } }