Search in sources :

Example 6 with TupleImpl

use of backtype.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(backtype.storm.tuple.TupleImpl) Tuple(backtype.storm.tuple.Tuple)

Example 7 with TupleImpl

use of backtype.storm.tuple.TupleImpl in project storm by nathanmarz.

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(backtype.storm.tuple.TupleImpl) MessageId(backtype.storm.tuple.MessageId)

Aggregations

TupleImpl (backtype.storm.tuple.TupleImpl)7 Tuple (backtype.storm.tuple.Tuple)3 ArrayList (java.util.ArrayList)3 Config (backtype.storm.Config)1 TopologyContext (backtype.storm.task.TopologyContext)1 TopologyBuilder (backtype.storm.topology.TopologyBuilder)1 MessageId (backtype.storm.tuple.MessageId)1 DefaultTupleMapper (com.hmsonline.storm.contrib.bolt.elasticsearch.mapper.DefaultTupleMapper)1 IOException (java.io.IOException)1 Test (org.junit.Test)1