本文整理了Java中backtype.storm.task.TopologyContext.getComponentOutputFields()
方法的一些代码示例,展示了TopologyContext.getComponentOutputFields()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TopologyContext.getComponentOutputFields()
方法的具体详情如下:
包路径:backtype.storm.task.TopologyContext
类名称:TopologyContext
方法名:getComponentOutputFields
[英]Gets the declared output fields for the specified global stream id.
[中]获取指定全局流id的声明输出字段。
代码示例来源:origin: alibaba/jstorm
/**
* Gets the declared output fields for the specified stream id for the component this task is a part of.
*/
public Fields getThisOutputFields(String streamId) {
return getComponentOutputFields(getThisComponentId(), streamId);
}
代码示例来源:origin: alibaba/mdrill
/**
* Gets the declared output fields for the specified stream id for the component
* this task is a part of.
*/
public Fields getThisOutputFields(String streamId) {
return getComponentOutputFields(getThisComponentId(), streamId);
}
代码示例来源:origin: alibaba/jstorm
private Fields getSourceOutputFields(TopologyContext context, String sourceStream) {
for (GlobalStreamId g : context.getThisSources().keySet()) {
if (g.get_streamId().equals(sourceStream)) {
return context.getComponentOutputFields(g);
}
}
throw new RuntimeException("Could not find fields for source stream " + sourceStream);
}
代码示例来源:origin: alibaba/mdrill
/**
* Gets the names of the fields in this tuple.
*/
public Fields getFields() {
return context.getComponentOutputFields(getSourceComponent(), getSourceStreamId());
}
代码示例来源:origin: alibaba/mdrill
/**
* Gets the declared output fields for the specified global stream id.
*/
public Fields getComponentOutputFields(GlobalStreamId id) {
return getComponentOutputFields(id.get_componentId(), id.get_streamId());
}
代码示例来源:origin: alibaba/mdrill
public Tuple(TopologyContext context, List<Object> values, int taskId, String streamId, MessageId id) {
super();
this.values = values;
this.taskId = taskId;
this.streamId = streamId;
this.id = id;
this.context = context;
String componentId = context.getComponentId(taskId);
Fields schema = context.getComponentOutputFields(componentId, streamId);
if(values.size()!=schema.size()) {
throw new IllegalArgumentException(
"Tuple created with wrong number of fields. " +
"Expected " + schema.size() + " fields but got " +
values.size() + " fields");
}
}
代码示例来源:origin: alibaba/jstorm
Set<String> idFields = null;
for (GlobalStreamId source : context.getThisSources().keySet()) {
Fields fields = context.getComponentOutputFields(source.get_componentId(), source.get_streamId());
Set<String> setFields = new HashSet<String>(fields.toList());
if (idFields == null)
代码示例来源:origin: com.n3twork.storm/storm-core
/**
* Gets the declared output fields for the specified stream id for the component
* this task is a part of.
*/
public Fields getThisOutputFields(String streamId) {
return getComponentOutputFields(getThisComponentId(), streamId);
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
/**
* Gets the declared output fields for the specified stream id for the component this task is a part of.
*/
public Fields getThisOutputFields(String streamId) {
return getComponentOutputFields(getThisComponentId(), streamId);
}
代码示例来源:origin: com.n3twork.storm/storm-core
private Fields getSourceOutputFields(TopologyContext context, String sourceStream) {
for(GlobalStreamId g: context.getThisSources().keySet()) {
if(g.get_streamId().equals(sourceStream)) {
return context.getComponentOutputFields(g);
}
}
throw new RuntimeException("Could not find fields for source stream " + sourceStream);
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
private Fields getSourceOutputFields(TopologyContext context, String sourceStream) {
for (GlobalStreamId g : context.getThisSources().keySet()) {
if (g.get_streamId().equals(sourceStream)) {
return context.getComponentOutputFields(g);
}
}
throw new RuntimeException("Could not find fields for source stream " + sourceStream);
}
代码示例来源:origin: mayconbordin/storm-applications
@Override
public String format(Tuple tuple) {
Fields schema = context.getComponentOutputFields(tuple.getSourceComponent(), tuple.getSourceStreamId());
String line = "";
for (int i=0; i<tuple.size(); i++) {
if (i != 0) line += ", ";
line += String.format("%s=%s", schema.get(i), tuple.getValue(i));
}
return line;
}
代码示例来源:origin: mayconbordin/storm-applications
@Override
public String format(Tuple tuple) {
Fields schema = context.getComponentOutputFields(tuple.getSourceComponent(), tuple.getSourceStreamId());
String values = "";
for (int i=0; i<tuple.size(); i++) {
if (i != 0) values += ", ";
values += String.format("%s=%s", schema.get(i), tuple.getValue(i));
}
return String.format(TEMPLATE, tuple.getSourceComponent(), tuple.getSourceTask(),
tuple.getSourceStreamId(), tuple.getMessageId().toString(), values);
}
代码示例来源:origin: tomdz/storm-esper
private void setupEventTypes(TopologyContext context, Configuration configuration)
{
Set<GlobalStreamId> sourceIds = context.getThisSources().keySet();
for (GlobalStreamId id : sourceIds) {
String eventTypeName = getEventTypeName(id.get_componentId(), id.get_streamId());
Fields fields = context.getComponentOutputFields(id.get_componentId(), id.get_streamId());
TupleTypeDescriptor typeDesc = tupleTypes.get(new StreamId(id.get_componentId(), id.get_streamId()));
Map<String, Object> props = setupEventTypeProperties(fields, typeDesc);
configuration.addEventType(eventTypeName, props);
}
}
内容来源于网络,如有侵权,请联系作者删除!