Search in sources :

Example 6 with TridentOperationContext

use of org.apache.storm.trident.operation.TridentOperationContext in project storm by apache.

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(org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory) ProjectionFactory(org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory) Factory(org.apache.storm.trident.tuple.TridentTuple.Factory) TridentOperationContext(org.apache.storm.trident.operation.TridentOperationContext)

Example 7 with TridentOperationContext

use of org.apache.storm.trident.operation.TridentOperationContext in project storm by apache.

the class MapProcessor method prepare.

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

Aggregations

TridentOperationContext (org.apache.storm.trident.operation.TridentOperationContext)7 Factory (org.apache.storm.trident.tuple.TridentTuple.Factory)4 ProjectionFactory (org.apache.storm.trident.tuple.TridentTupleView.ProjectionFactory)4 TridentTupleView (org.apache.storm.trident.tuple.TridentTupleView)1