src/main/java/edu/ucla/library/bucketeer/handlers/AbstractBucketeerHandler.java
protected void sendMessage(final Vertx aVertx, final JsonObject aJsonObject, final String aVerticleName,
            final long aTimeout) {
        final DeliveryOptions options = new DeliveryOptions().setSendTimeout(aTimeout);

        aVertx.eventBus().request(aVerticleName, aJsonObject, options, response -> {
            if (response.failed()) {
                final Throwable exception = response.cause();
                final Logger log = getLogger();

                if (exception != null) {
                    if (exception instanceof ReplyException) {
                        final ReplyException replyException = (ReplyException) exception;
                        final String messageCode = CodeUtils.getCode(replyException.failureCode());
                        final String messageDetails = replyException.getMessage();
                        final String failureReason;

                        try {
                            failureReason = log.getMessage(messageCode, messageDetails);
                            log.error(MessageCodes.BUCKETEER_005, aVerticleName, failureReason);
                        } catch (final IndexOutOfBoundsException details) {
                            // Different number of slots and values
                            log.error(MessageCodes.BUCKETEER_005, aVerticleName, messageCode);
                            log.error(MessageCodes.BUCKETEER_154, messageCode, messageDetails, details.getMessage());
                        }
                    } else {
                        log.error(exception, MessageCodes.BUCKETEER_005, aVerticleName, exception.getMessage());
                    }
                } else {
                    log.error(MessageCodes.BUCKETEER_005, aVerticleName, log.getMessage(MessageCodes.BUCKETEER_136));
                }
            } else if (response.result().body().equals(Op.RETRY)) {
                getLogger().debug(MessageCodes.BUCKETEER_048, aVerticleName);
                sendMessage(aVertx, aJsonObject, aVerticleName, aTimeout);
            }

            // Do nothing if the response is an Op.SUCCESS
        });
    }
/**
     * Sends a message to another verticle with a supplied timeout value.
     *
     * @param aVertx A reference to the Vert.x instance
     * @param aJsonObject A JSON message
     * @param aVerticleName A verticle name that will respond to the message
     * @param aTimeout A timeout measured in milliseconds
     */
Sends a message to another verticle with a supplied timeout value.
@param aVertx A reference to the Vert.x instance
@param aJsonObject A JSON message
@param aVerticleName A verticle name that will respond to the message
@param aTimeout A timeout measured in milliseconds
Sends a message to another verticle with a supplied timeout value . @param aVertx A reference to the Vert . x instance @param aJsonObject A JSON message @param aVerticleName A verticle name that will respond to the message @param aTimeout A timeout measured in milliseconds
protected void sendMessage(final Vertx aVertx, final JsonObject aJsonObject, final String aVerticleName,
            final long aTimeout) {
        final DeliveryOptions options = new DeliveryOptions().setSendTimeout(aTimeout);
        aVertx.eventBus().request(aVerticleName, aJsonObject, options, response -> {
            if (response.failed()) {
                final Throwable exception = response.cause();
                final Logger log = getLogger();
                if (exception != null) {
                    if (exception instanceof ReplyException) {
                        final ReplyException replyException = (ReplyException) exception;
                        final String messageCode = CodeUtils.getCode(replyException.failureCode());
                        final String messageDetails = replyException.getMessage();
                        final String failureReason;
                        try {
                            failureReason = log.getMessage(messageCode, messageDetails);
                            log.error(MessageCodes.BUCKETEER_005, aVerticleName, failureReason);
                        } catch (final IndexOutOfBoundsException details) {
                            log.error(MessageCodes.BUCKETEER_005, aVerticleName, messageCode);
                            log.error(MessageCodes.BUCKETEER_154, messageCode, messageDetails, details.getMessage());
                        }
                    } else {
                        log.error(exception, MessageCodes.BUCKETEER_005, aVerticleName, exception.getMessage());
                    }
                } else {
                    log.error(MessageCodes.BUCKETEER_005, aVerticleName, log.getMessage(MessageCodes.BUCKETEER_136));
                }
            } else if (response.result().body().equals(Op.RETRY)) {
                getLogger().debug(MessageCodes.BUCKETEER_048, aVerticleName);
                sendMessage(aVertx, aJsonObject, aVerticleName, aTimeout);
            }
        });
    }
protected void sendMessage ( final Vertx aVertx , final JsonObject aJsonObject , final String aVerticleName , final long aTimeout ) { final DeliveryOptions options = new DeliveryOptions ( ) . setSendTimeout ( aTimeout ) ; aVertx . eventBus ( ) . request ( aVerticleName , aJsonObject , options , response -> { if ( response . failed ( ) ) { final Throwable exception = response . cause ( ) ; final Logger log = getLogger ( ) ; if ( exception != null ) { if ( exception instanceof ReplyException ) { final ReplyException replyException = ( ReplyException ) exception ; final String messageCode = CodeUtils . getCode ( replyException . failureCode ( ) ) ; final String messageDetails = replyException . getMessage ( ) ; final String failureReason ; try { failureReason = log . getMessage ( messageCode , messageDetails ) ; log . error ( MessageCodes . BUCKETEER_005 , aVerticleName , failureReason ) ; } catch ( final IndexOutOfBoundsException details ) { log . error ( MessageCodes . BUCKETEER_005 , aVerticleName , messageCode ) ; log . error ( MessageCodes . BUCKETEER_154 , messageCode , messageDetails , details . getMessage ( ) ) ; } } else { log . error ( exception , MessageCodes . BUCKETEER_005 , aVerticleName , exception . getMessage ( ) ) ; } } else { log . error ( MessageCodes . BUCKETEER_005 , aVerticleName , log . getMessage ( MessageCodes . BUCKETEER_136 ) ) ; } } else if ( response . result ( ) . body ( ) . equals ( Op . RETRY ) ) { getLogger ( ) . debug ( MessageCodes . BUCKETEER_048 , aVerticleName ) ; sendMessage ( aVertx , aJsonObject , aVerticleName , aTimeout ) ; } } ) ; }
Sends a message to another verticle with a supplied timeout value.
Sends a message to another verticle with a supplied timeout value .
// Different number of slots and values // Do nothing if the response is an Op.SUCCESS