use of zipkin2.codec.BytesDecoder in project zipkin-azure by openzipkin.
the class ZipkinEventProcessor method onEvents.
@Override
public void onEvents(PartitionContext context, Iterable<EventData> messages) throws ExecutionException, InterruptedException {
// don't issue a write until we checkpoint or exit this callback
List<Span> buffer = new ArrayList<>();
for (EventData data : messages) {
byte[] bytes = data.getBytes();
BytesDecoder<Span> decoder = decoderForListMessage(bytes);
List<Span> nextSpans = decoder.decodeList(bytes);
buffer.addAll(nextSpans);
if (maybeCheckpoint(context, data, nextSpans.size())) {
collector.accept(buffer, NOOP);
buffer.clear();
}
}
if (!buffer.isEmpty()) {
collector.accept(buffer, NOOP);
}
}