Search in sources :

Example 6 with GeneralTopologyContext

use of org.apache.storm.task.GeneralTopologyContext in project storm by apache.

the class TestHiveBolt method generateTestTuple.

private Tuple generateTestTuple(Object id, Object msg, Object city, Object state) {
    TopologyBuilder builder = new TopologyBuilder();
    GeneralTopologyContext topologyContext = new GeneralTopologyContext(builder.createTopology(), new Config(), new HashMap(), new HashMap(), new HashMap(), "") {

        @Override
        public Fields getComponentOutputFields(String componentId, String streamId) {
            return new Fields("id", "msg", "city", "state");
        }
    };
    return new TupleImpl(topologyContext, new Values(id, msg, city, state), 1, "");
}
Also used : Fields(org.apache.storm.tuple.Fields) GeneralTopologyContext(org.apache.storm.task.GeneralTopologyContext) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) HashMap(java.util.HashMap) Config(org.apache.storm.Config) Values(org.apache.storm.tuple.Values) TupleImpl(org.apache.storm.tuple.TupleImpl)

Example 7 with GeneralTopologyContext

use of org.apache.storm.task.GeneralTopologyContext in project storm by apache.

the class KafkaBoltTest method generateTestTuple.

private Tuple generateTestTuple(Object key, Object message) {
    TopologyBuilder builder = new TopologyBuilder();
    GeneralTopologyContext topologyContext = new GeneralTopologyContext(builder.createTopology(), new Config(), new HashMap<>(), new HashMap<>(), new HashMap<>(), "") {

        @Override
        public Fields getComponentOutputFields(String componentId, String streamId) {
            return new Fields("key", "message");
        }
    };
    return new TupleImpl(topologyContext, new Values(key, message), 1, "");
}
Also used : Fields(org.apache.storm.tuple.Fields) GeneralTopologyContext(org.apache.storm.task.GeneralTopologyContext) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) Config(org.apache.storm.Config) Values(org.apache.storm.tuple.Values) TupleImpl(org.apache.storm.tuple.TupleImpl)

Aggregations

Config (org.apache.storm.Config)7 GeneralTopologyContext (org.apache.storm.task.GeneralTopologyContext)7 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)7 Fields (org.apache.storm.tuple.Fields)7 TupleImpl (org.apache.storm.tuple.TupleImpl)7 Values (org.apache.storm.tuple.Values)7 HashMap (java.util.HashMap)6