Search in sources :

Example 1 with BytesDecoder

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);
    }
}
Also used : ArrayList(java.util.ArrayList) Span(zipkin2.Span) EventData(com.microsoft.azure.eventhubs.EventData)

Aggregations

EventData (com.microsoft.azure.eventhubs.EventData)1 ArrayList (java.util.ArrayList)1 Span (zipkin2.Span)1