
com.hmsonline.storm.elasticsearch.trident.ElasticSearchStateUpdater Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of storm-elastic-search Show documentation
Show all versions of storm-elastic-search Show documentation
Storm Elastic Search Support
The newest version!
//
// Copyright (c) 2013 Health Market Science, Inc.
//
package com.hmsonline.storm.elasticsearch.trident;
import java.util.List;
import storm.trident.operation.TridentCollector;
import storm.trident.state.BaseStateUpdater;
import storm.trident.tuple.TridentTuple;
import com.hmsonline.storm.elasticsearch.mapper.TridentElasticSearchMapper;
public class ElasticSearchStateUpdater extends BaseStateUpdater {
/**
*
*/
private static final long serialVersionUID = -3617012135777283898L;
private TridentElasticSearchMapper mapper;
private boolean emitValue;
public ElasticSearchStateUpdater(TridentElasticSearchMapper mapper) {
this(mapper, Boolean.FALSE);
}
public ElasticSearchStateUpdater(TridentElasticSearchMapper mapper, boolean emitValue) {
this.mapper = mapper;
this.emitValue = emitValue;
}
@Override
public void updateState(ElasticSearchState state, List tuples, TridentCollector collector) {
state.createIndices(mapper, tuples);
if (emitValue) {
for (TridentTuple tuple : tuples) {
collector.emit(tuple.getValues());
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy