use of com.ibm.streams.operator.encoding.BinaryEncoding in project streamsx.topology by IBMStreams.
the class TesterSink method processBatch.
@Override
protected boolean processBatch(Queue<BatchedTuple> batch) throws Exception {
List<WriteFuture> futures = new ArrayList<>(batch.size());
for (BatchedTuple bt : batch) {
int portIndex = bt.getStream().getPortNumber();
TCPTestClient client = clients[portIndex];
BinaryEncoding be = encoders[portIndex];
byte[] tupleData = new byte[(int) be.getEncodedSize(bt.getTuple())];
be.encodeTuple(bt.getTuple(), ByteBuffer.wrap(tupleData));
TestTuple tt = new TestTuple(portIndex, tupleData);
futures.add(client.writeTuple(tt));
}
for (WriteFuture future : futures) {
future.await();
}
return false;
}
Aggregations