Search in sources :

Example 11 with StateFactory

use of org.apache.storm.trident.state.StateFactory in project storm by apache.

the class SolrJsonTridentTopology method getTopology.

protected StormTopology getTopology() throws IOException {
    final TridentTopology topology = new TridentTopology();
    final SolrJsonSpout spout = new SolrJsonSpout();
    final Stream stream = topology.newStream("SolrJsonSpout", spout);
    final StateFactory solrStateFactory = new SolrStateFactory(getSolrConfig(), getSolrMapper());
    stream.partitionPersist(solrStateFactory, spout.getOutputFields(), new SolrUpdater(), new Fields());
    return topology.build();
}
Also used : StateFactory(org.apache.storm.trident.state.StateFactory) Fields(org.apache.storm.tuple.Fields) TridentTopology(org.apache.storm.trident.TridentTopology) SolrJsonSpout(org.apache.storm.solr.spout.SolrJsonSpout) Stream(org.apache.storm.trident.Stream)

Example 12 with StateFactory

use of org.apache.storm.trident.state.StateFactory in project storm by apache.

the class SolrFieldsTridentTopology method getTopology.

protected StormTopology getTopology() throws IOException {
    final TridentTopology tridentTopology = new TridentTopology();
    final SolrFieldsSpout spout = new SolrFieldsSpout();
    final Stream stream = tridentTopology.newStream("SolrFieldsSpout", spout);
    final StateFactory solrStateFactory = new SolrStateFactory(getSolrConfig(), getSolrMapper());
    stream.partitionPersist(solrStateFactory, spout.getOutputFields(), new SolrUpdater(), new Fields());
    return tridentTopology.build();
}
Also used : StateFactory(org.apache.storm.trident.state.StateFactory) Fields(org.apache.storm.tuple.Fields) TridentTopology(org.apache.storm.trident.TridentTopology) Stream(org.apache.storm.trident.Stream) SolrFieldsSpout(org.apache.storm.solr.spout.SolrFieldsSpout)

Aggregations

StateFactory (org.apache.storm.trident.state.StateFactory)12 Fields (org.apache.storm.tuple.Fields)12 Stream (org.apache.storm.trident.Stream)11 TridentTopology (org.apache.storm.trident.TridentTopology)11 TridentState (org.apache.storm.trident.TridentState)9 Values (org.apache.storm.tuple.Values)7 FixedBatchSpout (org.apache.storm.trident.testing.FixedBatchSpout)5 MapGet (org.apache.storm.trident.operation.builtin.MapGet)3 Sum (org.apache.storm.trident.operation.builtin.Sum)3 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 FileRotationPolicy (org.apache.storm.hdfs.trident.rotation.FileRotationPolicy)2 FileSizeRotationPolicy (org.apache.storm.hdfs.trident.rotation.FileSizeRotationPolicy)2 MongoMapper (org.apache.storm.mongodb.common.mapper.MongoMapper)2 SimpleMongoMapper (org.apache.storm.mongodb.common.mapper.SimpleMongoMapper)2 RedisDataTypeDescription (org.apache.storm.redis.common.mapper.RedisDataTypeDescription)2 InetSocketAddress (java.net.InetSocketAddress)1 HashSet (java.util.HashSet)1 LocalCluster (org.apache.storm.LocalCluster)1 LocalTopology (org.apache.storm.LocalCluster.LocalTopology)1