本文整理汇总了Java中backtype.storm.topology.IComponent.declareOutputFields方法的典型用法代码示例。如果您正苦于以下问题:Java IComponent.declareOutputFields方法的具体用法?Java IComponent.declareOutputFields怎么用?Java IComponent.declareOutputFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backtype.storm.topology.IComponent
的用法示例。
在下文中一共展示了IComponent.declareOutputFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCreateTimestampAttributeToSchemas
import backtype.storm.topology.IComponent; //导入方法依赖的package包/类
static void addCreateTimestampAttributeToSchemas(IComponent spoutOrBolt, OutputFieldsDeclarer declarer) {
TransparentFieldsDeclarer transparentDeclarer = new TransparentFieldsDeclarer();
spoutOrBolt.declareOutputFields(transparentDeclarer);
for(Entry<String, List<String>> declaredStream : transparentDeclarer.declaredStreams.entrySet()) {
String streamId = declaredStream.getKey();
boolean direct = transparentDeclarer.directStreams.contains(streamId);
ArrayList<String> fieldsWithID = new ArrayList<String>(declaredStream.getValue());
if(!streamId.startsWith("aeolus::")) {
fieldsWithID.add(CREATE_TS_FIELD_NAME);
}
declarer.declareStream(streamId, direct, new Fields(fieldsWithID));
}
}
示例2: getSingleOutputStreamFields
import backtype.storm.topology.IComponent; //导入方法依赖的package包/类
public static Fields getSingleOutputStreamFields(IComponent component) {
OutputFieldsGetter getter = new OutputFieldsGetter();
component.declareOutputFields(getter);
Map<String, StreamInfo> declaration = getter.getFieldsDeclaration();
if(declaration.size()!=1) {
throw new RuntimeException("Trident only supports components that emit a single stream");
}
StreamInfo si = declaration.values().iterator().next();
if(si.is_direct()) {
throw new RuntimeException("Trident does not support direct streams");
}
return new Fields(si.get_output_fields());
}
示例3: getSingleOutputStreamFields
import backtype.storm.topology.IComponent; //导入方法依赖的package包/类
public static Fields getSingleOutputStreamFields(IComponent component) {
OutputFieldsGetter getter = new OutputFieldsGetter();
component.declareOutputFields(getter);
Map<String, StreamInfo> declaration = getter.getFieldsDeclaration();
if(declaration.size()!=1) {
throw new RuntimeException("Trident only supports components that emit a single stream");
}
StreamInfo si = declaration.values().iterator().next();
if(si.is_direct()) {
throw new RuntimeException("Trident does not support direct streams");
}
return new Fields(si.get_output_fields());
}