Search in sources :

Example 11 with Factory

use of storm.trident.tuple.TridentTuple.Factory in project jstorm by alibaba.

the class EachProcessor method prepare.

@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("Each operation can only have one parent");
    }
    _context = tridentContext;
    _collector = new AppendCollector(tridentContext);
    _projection = new ProjectionFactory(parents.get(0), _inputFields);
    _function.prepare(conf, new TridentOperationContext(context, _projection));
}
Also used : ProjectionFactory(storm.trident.tuple.TridentTupleView.ProjectionFactory) ProjectionFactory(storm.trident.tuple.TridentTupleView.ProjectionFactory) Factory(storm.trident.tuple.TridentTuple.Factory) TridentOperationContext(storm.trident.operation.TridentOperationContext)

Example 12 with Factory

use of storm.trident.tuple.TridentTuple.Factory in project storm by nathanmarz.

the class StateQueryProcessor method prepare.

@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("State query operation can only have one parent");
    }
    _context = tridentContext;
    _state = (State) context.getTaskData(_stateId);
    _projection = new ProjectionFactory(parents.get(0), _inputFields);
    _collector = new AppendCollector(tridentContext);
    _function.prepare(conf, new TridentOperationContext(context, _projection));
}
Also used : ProjectionFactory(storm.trident.tuple.TridentTupleView.ProjectionFactory) Factory(storm.trident.tuple.TridentTuple.Factory) ProjectionFactory(storm.trident.tuple.TridentTupleView.ProjectionFactory) TridentOperationContext(storm.trident.operation.TridentOperationContext)

Aggregations

Factory (storm.trident.tuple.TridentTuple.Factory)12 ProjectionFactory (storm.trident.tuple.TridentTupleView.ProjectionFactory)12 TridentOperationContext (storm.trident.operation.TridentOperationContext)8 List (java.util.List)2 DirectedSubgraph (org.jgrapht.graph.DirectedSubgraph)2 TopologicalOrderIterator (org.jgrapht.traverse.TopologicalOrderIterator)2 TridentMultiReducerContext (storm.trident.operation.TridentMultiReducerContext)2 TridentContext (storm.trident.planner.processor.TridentContext)2 State (storm.trident.state.State)2 RootFactory (storm.trident.tuple.TridentTupleView.RootFactory)2 ArrayList (java.util.ArrayList)1