本文整理了Java中org.apache.helix.model.Message.getAttribute()
方法的一些代码示例,展示了Message.getAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getAttribute()
方法的具体详情如下:
包路径:org.apache.helix.model.Message
类名称:Message
方法名:getAttribute
[英]Get the value of an attribute
[中]获取属性的值
代码示例来源:origin: apache/incubator-gobblin
@Override
public HelixTaskResult handleMessage()
throws InterruptedException {
if (jobScheduler.isActive()) {
// we want to make sure current node is in active state
String msg = _message.getAttribute(Message.Attributes.INNER_MESSAGE);
log.info("{} ControllerUserDefinedMessage received : {}, type {}", this.serviceName, msg, _message.getMsgSubType());
try {
if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_ADD)) {
handleAdd(msg);
} else if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE)) {
handleDelete(msg);
} else if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE)) {
handleUpdate(msg);
}
} catch (IOException e) {
log.error("Cannot process Helix message.", e);
HelixTaskResult helixTaskResult = new HelixTaskResult();
helixTaskResult.setSuccess(false);
return helixTaskResult;
}
} else {
String msg = _message.getAttribute(Message.Attributes.INNER_MESSAGE);
log.error("ControllerUserDefinedMessage received but ignored due to not in active mode: {}, type {}", msg,
_message.getMsgSubType());
}
HelixTaskResult helixTaskResult = new HelixTaskResult();
helixTaskResult.setSuccess(true);
return helixTaskResult;
}
代码示例来源:origin: apache/helix
public GroupMessageInfo onCompleteSubMessage(Message subMessage) {
String parentMid = subMessage.getAttribute(Attributes.PARENT_MSG_ID);
GroupMessageInfo info = _groupMsgMap.get(parentMid);
if (info != null) {
int val = info._countDown.decrementAndGet();
if (val <= 0) {
return _groupMsgMap.remove(parentMid);
}
}
return null;
}
代码示例来源:origin: org.apache.helix/helix-core
public GroupMessageInfo onCompleteSubMessage(Message subMessage) {
String parentMid = subMessage.getAttribute(Attributes.PARENT_MSG_ID);
GroupMessageInfo info = _groupMsgMap.get(parentMid);
if (info != null) {
int val = info._countDown.decrementAndGet();
if (val <= 0) {
return _groupMsgMap.remove(parentMid);
}
}
return null;
}
代码示例来源:origin: org.apache.helix/helix-core
void addCurStateUpdate(Message subMessage, PropertyKey key, CurrentState delta) {
String parentMid = subMessage.getAttribute(Attributes.PARENT_MSG_ID);
GroupMessageInfo info = _groupMsgMap.get(parentMid);
if (info != null) {
info._curStateUpdateList.add(new CurrentStateUpdate(key, delta));
}
}
}
代码示例来源:origin: apache/helix
void addCurStateUpdate(Message subMessage, PropertyKey key, CurrentState delta) {
String parentMid = subMessage.getAttribute(Attributes.PARENT_MSG_ID);
GroupMessageInfo info = _groupMsgMap.get(parentMid);
if (info != null) {
info._curStateUpdateList.add(new CurrentStateUpdate(key, delta));
}
}
}
代码示例来源:origin: apache/helix
private static String instantiateByMessage(String string, Message message) {
Matcher matcher = pattern.matcher(string);
String result = string;
while (matcher.find()) {
String var = matcher.group();
result =
result.replace(var,
message.getAttribute(Message.Attributes.valueOf(var.substring(1, var.length() - 1))));
}
return result;
}
代码示例来源:origin: org.apache.helix/helix-core
String instanceName = message.getAttribute(Message.Attributes.TGT_NAME);
String resourceName = message.getAttribute(Message.Attributes.RESOURCE_NAME);
代码示例来源:origin: apache/helix
String instanceName = message.getAttribute(Message.Attributes.TGT_NAME);
String resourceName = message.getAttribute(Message.Attributes.RESOURCE_NAME);
代码示例来源:origin: com.linkedin.gobblin/gobblin-service
@Override
public HelixTaskResult handleMessage() throws InterruptedException {
if (jobScheduler.isActive()) {
String flowSpecUri = _message.getAttribute(Message.Attributes.INNER_MESSAGE);
try {
if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_ADD)) {
Spec spec = flowCatalog.getSpec(new URI(flowSpecUri));
this.jobScheduler.onAddSpec(spec);
} else if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE)) {
List<String> flowSpecUriParts = Splitter.on(":").omitEmptyStrings().trimResults().splitToList(flowSpecUri);
this.jobScheduler.onDeleteSpec(new URI(flowSpecUriParts.get(0)), flowSpecUriParts.get(1));
} else if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE)) {
Spec spec = flowCatalog.getSpec(new URI(flowSpecUri));
this.jobScheduler.onUpdateSpec(spec);
}
} catch (SpecNotFoundException | URISyntaxException e) {
LOGGER.error("Cannot process Helix message for flowSpecUri: " + flowSpecUri, e);
}
}
HelixTaskResult helixTaskResult = new HelixTaskResult();
helixTaskResult.setSuccess(true);
return helixTaskResult;
}
代码示例来源:origin: apache/helix
private void finalCleanup(HelixTaskResult taskResult) {
try {
if (_message.getAttribute(Attributes.PARENT_MSG_ID) == null) {
removeMessageFromZk(_manager.getHelixDataAccessor(), _message);
reportMessageStat(_manager, _message, taskResult);
sendReply(getSrcClusterDataAccessor(_message), _message, taskResult);
_executor.finishTask(this);
}
} catch (Exception e) {
logger.error(String.format("Error to final clean up for message : %s", _message.getId()));
}
}
}
代码示例来源:origin: org.apache.gobblin/gobblin-service
@Override
public HelixTaskResult handleMessage()
throws InterruptedException {
if (jobScheduler.isActive()) {
// we want to make sure current node is in active state
String msg = _message.getAttribute(Message.Attributes.INNER_MESSAGE);
log.info("{} ControllerUserDefinedMessage received : {}, type {}", this.serviceName, msg, _message.getMsgSubType());
try {
if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_ADD)) {
handleAdd(msg);
} else if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE)) {
handleDelete(msg);
} else if (_message.getMsgSubType().equals(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE)) {
handleUpdate(msg);
}
} catch (IOException e) {
log.error("Cannot process Helix message.", e);
HelixTaskResult helixTaskResult = new HelixTaskResult();
helixTaskResult.setSuccess(false);
return helixTaskResult;
}
} else {
String msg = _message.getAttribute(Message.Attributes.INNER_MESSAGE);
log.error("ControllerUserDefinedMessage received but ignored due to not in active mode: {}, type {}", msg,
_message.getMsgSubType());
}
HelixTaskResult helixTaskResult = new HelixTaskResult();
helixTaskResult.setSuccess(true);
return helixTaskResult;
}
代码示例来源:origin: apache/helix
logger.info(
"Message: {} (parent: {}) handling task for {}:{} completed at: {}, results: {}. FrameworkTime: {} ms; HandlerTime: {} ms.",
_message.getMsgId(), _message.getAttribute(Attributes.PARENT_MSG_ID), _message.getResourceName(),
_message.getPartitionName(), end, taskResult.isSuccess(), totalDuration - handlerDuration,
handlerDuration);
代码示例来源:origin: org.apache.helix/helix-core
if (_message.getAttribute(Attributes.PARENT_MSG_ID) == null) {
removeMessageFromZk(accessor, _message);
reportMessageStat(_manager, _message, taskResult);
logger.info(
"Message: {} (parent: {}) handling task for {}:{} completed at: {}, results: {}. FrameworkTime: {} ms; HandlerTime: {} ms.",
_message.getMsgId(), _message.getAttribute(Attributes.PARENT_MSG_ID), _message.getResourceName(),
_message.getPartitionName(), end, taskResult.isSuccess(), totalDuration - handlerDuration,
handlerDuration);
代码示例来源:origin: org.apache.helix/helix-core
keyBuilder.currentState(instanceName, sessionId, resource,
bucketizer.getBucketName(partitionKey));
if (_message.getAttribute(Attributes.PARENT_MSG_ID) == null) {
代码示例来源:origin: apache/helix
keyBuilder.currentState(instanceName, sessionId, resource,
bucketizer.getBucketName(partitionKey));
if (_message.getAttribute(Attributes.PARENT_MSG_ID) == null) {
内容来源于网络,如有侵权,请联系作者删除!