storm.trident.state.StateUpdater Java Examples

The following examples show how to use storm.trident.state.StateUpdater. 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: Stream.java    From jstorm with Apache License 2.0 5 votes vote down vote up
public TridentState partitionPersist(StateSpec stateSpec, Fields inputFields, StateUpdater updater, Fields functionFields) {
    projectionValidation(inputFields);
    String id = _topology.getUniqueStateId();
    ProcessorNode n = new ProcessorNode(_topology.getUniqueStreamId(),
                _name,
                functionFields,
                functionFields,
                new PartitionPersistProcessor(id, inputFields, updater));
    n.committer = true;
    n.stateInfo = new NodeStateInfo(id, stateSpec);
    return _topology.addSourcedStateNode(this, n);
}
 
Example #2
Source File: Stream.java    From jstorm with Apache License 2.0 5 votes vote down vote up
private Stream window(WindowConfig windowConfig, WindowsStoreFactory windowStoreFactory, Fields inputFields, Aggregator aggregator,
                      Fields functionFields, boolean storeTuplesInStore) {
    projectionValidation(inputFields);
    windowConfig.validate();

    Fields fields = addTriggerField(functionFields);

    // when storeTuplesInStore is false then the given windowStoreFactory is only used to store triggers and
    // that store is passed to WindowStateUpdater to remove them after committing the batch.
    Stream stream = _topology.addSourcedNode(this,
            new ProcessorNode(_topology.getUniqueStreamId(),
                    _name,
                    fields,
                    fields,
                    new WindowTridentProcessor(windowConfig, _topology.getUniqueWindowId(), windowStoreFactory,
                            inputFields, aggregator, storeTuplesInStore)));

    Stream effectiveStream = stream.project(functionFields);

    // create StateUpdater with the given windowStoreFactory to remove triggered aggregation results form store
    // when they are successfully processed.
    StateFactory stateFactory = new WindowsStateFactory();
    StateUpdater stateUpdater = new WindowsStateUpdater(windowStoreFactory);
    stream.partitionPersist(stateFactory, new Fields(WindowTridentProcessor.TRIGGER_FIELD_NAME), stateUpdater, new Fields());

    return effectiveStream;
}
 
Example #3
Source File: Stream.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentState partitionPersist(StateFactory stateFactory, Fields inputFields, StateUpdater updater, Fields functionFields) {
  return partitionPersist(new StateSpec(stateFactory), inputFields, updater, functionFields);
}
 
Example #4
Source File: Stream.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentState partitionPersist(StateFactory stateFactory, Fields inputFields, StateUpdater updater) {
    return partitionPersist(stateFactory, inputFields, updater, new Fields());
}
 
Example #5
Source File: Stream.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentState partitionPersist(StateSpec stateSpec, Fields inputFields, StateUpdater updater) {
    return partitionPersist(stateSpec, inputFields, updater, new Fields());
}
 
Example #6
Source File: Stream.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentState partitionPersist(StateFactory stateFactory, StateUpdater updater, Fields functionFields) {
    return partitionPersist(new StateSpec(stateFactory), updater, functionFields);
}
 
Example #7
Source File: Stream.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentState partitionPersist(StateSpec stateSpec, StateUpdater updater, Fields functionFields) {
    return partitionPersist(stateSpec, null, updater, functionFields);
}
 
Example #8
Source File: Stream.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentState partitionPersist(StateFactory stateFactory, StateUpdater updater) {
    return partitionPersist(stateFactory, updater, new Fields());
}
 
Example #9
Source File: Stream.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public TridentState partitionPersist(StateSpec stateSpec, StateUpdater updater) {
    return partitionPersist(stateSpec, updater, new Fields());
}
 
Example #10
Source File: PartitionPersistProcessor.java    From jstorm with Apache License 2.0 4 votes vote down vote up
public PartitionPersistProcessor(String stateId, Fields inputFields, StateUpdater updater) {
    _updater = updater;
    _stateId = stateId;
    _inputFields = inputFields;
}