Search in sources :

Example 1 with DeliveryContext

use of io.vertx.core.eventbus.DeliveryContext in project vert.x by eclipse.

the class OutboundDeliveryContext method next.

@Override
public void next() {
    if (iter.hasNext()) {
        Handler<DeliveryContext> handler = iter.next();
        try {
            if (handler != null) {
                handler.handle(this);
            } else {
                next();
            }
        } catch (Throwable t) {
            EventBusImpl.log.error("Failure in interceptor", t);
        }
    } else {
        VertxTracer tracer = ctx.tracer();
        if (tracer != null) {
            if (message.trace == null) {
                src = true;
                BiConsumer<String, String> biConsumer = (String key, String val) -> message.headers().set(key, val);
                TracingPolicy tracingPolicy = options.getTracingPolicy();
                if (tracingPolicy == null) {
                    tracingPolicy = TracingPolicy.PROPAGATE;
                }
                message.trace = tracer.sendRequest(ctx, SpanKind.RPC, tracingPolicy, message, message.send ? "send" : "publish", biConsumer, MessageTagExtractor.INSTANCE);
            } else {
                // Handle failure here
                tracer.sendResponse(ctx, null, message.trace, null, TagExtractor.empty());
            }
        }
        bus.sendOrPub(this);
    }
}
Also used : VertxTracer(io.vertx.core.spi.tracing.VertxTracer) TracingPolicy(io.vertx.core.tracing.TracingPolicy) DeliveryContext(io.vertx.core.eventbus.DeliveryContext)

Aggregations

DeliveryContext (io.vertx.core.eventbus.DeliveryContext)1 VertxTracer (io.vertx.core.spi.tracing.VertxTracer)1 TracingPolicy (io.vertx.core.tracing.TracingPolicy)1