use of org.apache.asterix.common.messaging.api.ICCMessageBroker in project asterixdb by apache.
the class FeedOperations method SendActiveMessage.
private static void SendActiveMessage(ICcApplicationContext appCtx, ActiveManagerMessage activeManagerMessage, String nodeId) throws Exception {
ICCMessageBroker messageBroker = (ICCMessageBroker) appCtx.getServiceContext().getMessageBroker();
messageBroker.sendApplicationMessageToNC(activeManagerMessage, nodeId);
}
use of org.apache.asterix.common.messaging.api.ICCMessageBroker in project asterixdb by apache.
the class ResourceIdRequestMessage method handle.
@Override
public void handle(ICcApplicationContext appCtx) throws HyracksDataException, InterruptedException {
try {
ICCMessageBroker broker = (ICCMessageBroker) appCtx.getServiceContext().getMessageBroker();
ResourceIdRequestResponseMessage reponse = new ResourceIdRequestResponseMessage();
if (!ClusterStateManager.INSTANCE.isClusterActive()) {
reponse.setResourceId(-1);
reponse.setException(new Exception("Cannot generate global resource id when cluster is not active."));
} else {
IResourceIdManager resourceIdManager = appCtx.getResourceIdManager();
reponse.setResourceId(resourceIdManager.createResourceId());
if (reponse.getResourceId() < 0) {
reponse.setException(new Exception("One or more nodes has not reported max resource id."));
}
requestMaxResourceID(resourceIdManager, broker);
}
broker.sendApplicationMessageToNC(reponse, src);
} catch (Exception e) {
throw HyracksDataException.create(e);
}
}
Aggregations