Java Code Examples for storm.trident.tuple.TridentTuple#Factory

The following examples show how to use storm.trident.tuple.TridentTuple#Factory . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowTridentProcessor.java    From jstorm with Apache License 2.0 6 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    this.conf = conf;
    this.topologyContext = context;
    List<TridentTuple.Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("Aggregation related operation can only have one parent");
    }

    Long maxTuplesCacheSize = getWindowTuplesCacheSize(conf);

    this.tridentContext = tridentContext;
    collector = new FreshCollector(tridentContext);
    projection = new TridentTupleView.ProjectionFactory(parents.get(0), inputFields);

    windowStore = windowStoreFactory.create();
    windowTaskId = windowId + WindowsStore.KEY_SEPARATOR + topologyContext.getThisTaskId() + WindowsStore.KEY_SEPARATOR;
    windowTriggerInprocessId = getWindowTriggerInprocessIdPrefix(windowTaskId);

    tridentWindowManager = storeTuplesInStore ?
            new StoreBasedTridentWindowManager(windowConfig, windowTaskId, windowStore, aggregator, tridentContext.getDelegateCollector(), maxTuplesCacheSize, inputFields)
            : new InMemoryTridentWindowManager(windowConfig, windowTaskId, windowStore, aggregator, tridentContext.getDelegateCollector());

    tridentWindowManager.prepare();
}
 
Example 2
Source File: MapProcessor.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example 3
Source File: TridentMultiReducerContext.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentMultiReducerContext(List<TridentTuple.Factory> factories) {
    _factories = factories;
}
 
Example 4
Source File: TridentOperationContext.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentOperationContext(TopologyContext topoContext, TridentTuple.Factory factory) {
    _factory = factory;
    _topoContext = topoContext;
}
 
Example 5
Source File: TridentOperationContext.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentOperationContext(TridentOperationContext parent, TridentTuple.Factory factory) {
    this(parent._topoContext, factory);
}
 
Example 6
Source File: MapProcessor.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public TridentTuple.Factory getOutputFactory() {
    return _collector.getOutputFactory();
}
 
Example 7
Source File: WindowTridentProcessor.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public TridentTuple.Factory getOutputFactory() {
    return collector.getOutputFactory();
}