@Override public void handle(Message<Object> message) { // Notification is potentially a blocking code // The execution of the blocking code is not ordered - see Vertx.executeBlocking(Handler<Future<T>>, boolean, Handler<AsyncResult<T>>) javadoc vertx.<Object> executeBlocking(future -> { VertxEventImpl vertxEvent = new VertxEventImpl(message, vertx.eventBus()); try { // Synchronously notify all the observer methods for a specific address event.fire(vertxEvent); future.complete(vertxEvent.getReply()); } catch (Exception e) { future.fail(e); } }, false, result -> { if (result.succeeded()) { message.reply(result.result()); } else { Throwable cause = result.cause(); if (cause instanceof RecipientFailure) { RecipientFailure recipientFailure = (RecipientFailure) cause; message.fail(recipientFailure.code, recipientFailure.getMessage()); } else { message.fail(VertxEvent.OBSERVER_FAILURE_CODE, cause.getMessage()); } } }); }
@Override public void handle(Message<Object> message) { // Notification is potentially a blocking code // The execution of the blocking code is not ordered - see Vertx.executeBlocking(Handler<Future<T>>, boolean, Handler<AsyncResult<T>>) javadoc vertx.<Object> executeBlocking(future -> { VertxEventImpl vertxEvent = new VertxEventImpl(message, vertx.eventBus()); try { // Synchronously notify all the observer methods for a specific address event.fire(vertxEvent); future.complete(vertxEvent.getReply()); } catch (Exception e) { future.fail(e); } }, false, result -> { if (result.succeeded()) { message.reply(result.result()); } else { Throwable cause = result.cause(); if (cause instanceof RecipientFailure) { RecipientFailure recipientFailure = (RecipientFailure) cause; message.fail(recipientFailure.code, recipientFailure.getMessage()); } else { message.fail(VertxEvent.OBSERVER_FAILURE_CODE, cause.getMessage()); } } }); }