use of org.apache.gobblin.cluster.GobblinHelixMessagingService in project incubator-gobblin by apache.
the class YarnAppSecurityManager method sendTokenFileUpdatedMessage.
@VisibleForTesting
void sendTokenFileUpdatedMessage(InstanceType instanceType) {
Criteria criteria = new Criteria();
criteria.setInstanceName("%");
criteria.setResource("%");
criteria.setPartition("%");
criteria.setPartitionState("%");
criteria.setRecipientInstanceType(instanceType);
/**
* #HELIX-0.6.7-WORKAROUND
* Add back when LIVESTANCES messaging is ported to 0.6 branch
* if (instanceType == InstanceType.PARTICIPANT) {
* criteria.setDataSource(Criteria.DataSource.LIVEINSTANCES);
* }
*/
criteria.setSessionSpecific(true);
Message tokenFileUpdatedMessage = new Message(Message.MessageType.USER_DEFINE_MSG, HelixMessageSubTypes.TOKEN_FILE_UPDATED.toString().toLowerCase() + UUID.randomUUID().toString());
tokenFileUpdatedMessage.setMsgSubType(HelixMessageSubTypes.TOKEN_FILE_UPDATED.toString());
tokenFileUpdatedMessage.setMsgState(Message.MessageState.NEW);
if (instanceType == InstanceType.CONTROLLER) {
tokenFileUpdatedMessage.setTgtSessionId("*");
}
// #HELIX-0.6.7-WORKAROUND
// Temporarily bypass the default messaging service to allow upgrade to 0.6.7 which is missing support
// for messaging to instances
// int messagesSent = this.helixManager.getMessagingService().send(criteria, tokenFileUpdatedMessage);
GobblinHelixMessagingService messagingService = new GobblinHelixMessagingService(this.helixManager);
int messagesSent = messagingService.send(criteria, tokenFileUpdatedMessage);
LOGGER.info(String.format("Sent %d token file updated message(s) to the %s", messagesSent, instanceType));
}
Aggregations