|
11 | 11 | package io.vertx.core.eventbus.impl; |
12 | 12 |
|
13 | 13 | import io.vertx.core.*; |
| 14 | +import io.vertx.core.eventbus.DeliveryContext; |
14 | 15 | import io.vertx.core.eventbus.Message; |
15 | 16 | import io.vertx.core.eventbus.ReplyException; |
16 | 17 | import io.vertx.core.eventbus.ReplyFailure; |
@@ -90,10 +91,15 @@ public Future<Void> unregister() { |
90 | 91 | return promise.future(); |
91 | 92 | } |
92 | 93 |
|
93 | | - void dispatchMessage(Handler<Message<T>> theHandler, MessageImpl<?, T> message, ContextInternal context) { |
94 | | - Runnable dispatch = () -> dispatch(context, message, theHandler); |
95 | | - DeliveryContextImpl<T> deliveryCtx = new DeliveryContextImpl<>(message, message.bus.inboundInterceptors(), context, message.receivedBody, dispatch); |
96 | | - deliveryCtx.next(); |
| 94 | + void dispatchMessage(Handler<Message<T>> handler, MessageImpl<?, T> message, ContextInternal context) { |
| 95 | + Handler<DeliveryContext<?>>[] interceptors = message.bus.inboundInterceptors(); |
| 96 | + if (interceptors.length > 0) { |
| 97 | + Runnable dispatch = () -> dispatch(context, message, handler); |
| 98 | + DeliveryContextImpl<T> deliveryCtx = new DeliveryContextImpl<>(message, interceptors, context, message.receivedBody, dispatch); |
| 99 | + deliveryCtx.next(); |
| 100 | + } else { |
| 101 | + dispatch(context, message, handler); |
| 102 | + } |
97 | 103 | } |
98 | 104 |
|
99 | 105 | private void dispatch(ContextInternal ctx, MessageImpl<?, T> message, Handler<Message<T>> handler) { |
|
0 commit comments