use of org.apache.storm.tuple.Fields in project storm by apache.
the class Executor method outboundComponents.
/**
* Returns map of stream id to component id to grouper
*/
private Map<String, Map<String, LoadAwareCustomStreamGrouping>> outboundComponents(WorkerTopologyContext workerTopologyContext, String componentId, Map stormConf) {
Map<String, Map<String, LoadAwareCustomStreamGrouping>> ret = new HashMap<>();
Map<String, Map<String, Grouping>> outputGroupings = workerTopologyContext.getTargets(componentId);
for (Map.Entry<String, Map<String, Grouping>> entry : outputGroupings.entrySet()) {
String streamId = entry.getKey();
Map<String, Grouping> componentGrouping = entry.getValue();
Fields outFields = workerTopologyContext.getComponentOutputFields(componentId, streamId);
Map<String, LoadAwareCustomStreamGrouping> componentGrouper = new HashMap<String, LoadAwareCustomStreamGrouping>();
for (Map.Entry<String, Grouping> cg : componentGrouping.entrySet()) {
String component = cg.getKey();
Grouping grouping = cg.getValue();
List<Integer> outTasks = workerTopologyContext.getComponentTasks(component);
LoadAwareCustomStreamGrouping grouper = GrouperFactory.mkGrouper(workerTopologyContext, componentId, streamId, outFields, grouping, outTasks, stormConf);
componentGrouper.put(component, grouper);
}
if (componentGrouper.size() > 0) {
ret.put(streamId, componentGrouper);
}
}
for (String stream : workerTopologyContext.getComponentCommon(componentId).get_streams().keySet()) {
if (!ret.containsKey(stream)) {
ret.put(stream, null);
}
}
return ret;
}
use of org.apache.storm.tuple.Fields in project storm by apache.
the class EsTestUtil method generateTestTuple.
public static Tuple generateTestTuple(String source, String index, String type, String id) {
TopologyBuilder builder = new TopologyBuilder();
GeneralTopologyContext topologyContext = new GeneralTopologyContext(builder.createTopology(), new Config(), new HashMap(), new HashMap(), new HashMap(), "") {
@Override
public Fields getComponentOutputFields(String componentId, String streamId) {
return new Fields("source", "index", "type", "id");
}
};
return new TupleImpl(topologyContext, new Values(source, index, type, id), 1, "");
}
use of org.apache.storm.tuple.Fields in project heron by twitter.
the class StringKeyValueSchemeTest method testGetOutputFields.
@Test
public void testGetOutputFields() throws Exception {
Fields outputFields = scheme.getOutputFields();
assertTrue(outputFields.contains(StringScheme.STRING_SCHEME_KEY));
assertEquals(1, outputFields.size());
}
use of org.apache.storm.tuple.Fields in project metron by apache.
the class ProfileSplitterBolt method declareOutputFields.
/**
* Each emitted tuple contains the following fields.
* <p>
* <ol>
* <li>message - The message containing JSON-formatted data that needs applied to a profile.
* <li>timestamp - The timestamp of the message.
* <li>entity - The name of the entity. The actual result of executing the Stellar expression.
* <li>profile - The profile definition that the message needs applied to.
* </ol>
* <p>
*/
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
// the order here must match 'createValues'
Fields fields = new Fields(MESSAGE_TUPLE_FIELD, TIMESTAMP_TUPLE_FIELD, ENTITY_TUPLE_FIELD, PROFILE_TUPLE_FIELD);
declarer.declare(fields);
}
use of org.apache.storm.tuple.Fields in project metron by apache.
the class GenericEnrichmentBolt method declareOutputFields.
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declareStream(enrichmentType, new Fields("key", "message", "subgroup"));
declarer.declareStream(ERROR_STREAM, new Fields("message"));
}
Aggregations