Search in sources :

Example 11 with TupleImpl

use of org.apache.storm.tuple.TupleImpl in project heron by twitter.

the class OutputCollectorImpl method emit.

@Override
public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) {
    if (anchors != null) {
        ArrayList<com.twitter.heron.api.tuple.Tuple> l = new ArrayList<com.twitter.heron.api.tuple.Tuple>();
        for (Tuple t : anchors) {
            TupleImpl i = (TupleImpl) t;
            l.add(i.getDelegate());
        }
        return delegate.emit(streamId, l, tuple);
    } else {
        return delegate.emit(streamId, (Collection<com.twitter.heron.api.tuple.Tuple>) null, tuple);
    }
}
Also used : ArrayList(java.util.ArrayList) TupleImpl(org.apache.storm.tuple.TupleImpl) Tuple(org.apache.storm.tuple.Tuple)

Example 12 with TupleImpl

use of org.apache.storm.tuple.TupleImpl in project heron by twitter.

the class IRichBoltDelegate method execute.

@Override
public void execute(com.twitter.heron.api.tuple.Tuple tuple) {
    TupleImpl impl = new TupleImpl(tuple);
    delegate.execute(impl);
}
Also used : TupleImpl(org.apache.storm.tuple.TupleImpl)

Example 13 with TupleImpl

use of org.apache.storm.tuple.TupleImpl in project storm by apache.

the class KryoTupleDeserializer method deserialize.

public Tuple deserialize(byte[] ser) {
    try {
        _kryoInput.setBuffer(ser);
        int taskId = _kryoInput.readInt(true);
        int streamId = _kryoInput.readInt(true);
        String componentName = _context.getComponentId(taskId);
        String streamName = _ids.getStreamName(componentName, streamId);
        MessageId id = MessageId.deserialize(_kryoInput);
        List<Object> values = _kryo.deserializeFrom(_kryoInput);
        return new TupleImpl(_context, values, taskId, streamName, id);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : IOException(java.io.IOException) TupleImpl(org.apache.storm.tuple.TupleImpl) MessageId(org.apache.storm.tuple.MessageId)

Example 14 with TupleImpl

use of org.apache.storm.tuple.TupleImpl in project storm by apache.

the class TestHiveWriter method generateTestTuple.

private Tuple generateTestTuple(Object id, Object msg) {
    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");
        }
    };
    return new TupleImpl(topologyContext, new Values(id, msg), 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 15 with TupleImpl

use of org.apache.storm.tuple.TupleImpl 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)

Aggregations

TupleImpl (org.apache.storm.tuple.TupleImpl)23 Values (org.apache.storm.tuple.Values)12 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)8 Fields (org.apache.storm.tuple.Fields)8 Config (org.apache.storm.Config)7 GeneralTopologyContext (org.apache.storm.task.GeneralTopologyContext)7 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)7 Tuple (org.apache.storm.tuple.Tuple)5 AddressedTuple (org.apache.storm.tuple.AddressedTuple)4 MessageId (org.apache.storm.tuple.MessageId)3 List (java.util.List)2 Map (java.util.Map)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 StormTimer (org.apache.storm.StormTimer)2 IOException (java.io.IOException)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 TupleInfo (org.apache.storm.executor.TupleInfo)1 BoltAckInfo (org.apache.storm.hooks.info.BoltAckInfo)1