All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.up.uca.micro.invoke.PingInvoker Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.uca.micro.invoke;

import io.vertx.core.Vertx;
import io.vertx.core.eventbus.Message;
import io.vertx.up.commune.Envelop;
import io.vertx.up.exception.web._501RpcRejectException;
import io.vertx.up.util.Ut;

import java.lang.reflect.Method;

/**
 * void method(Envelop)
 */
public class PingInvoker extends AbstractInvoker {

    @Override
    public void ensure(final Class returnType,
                       final Class paramCls) {
        final boolean valid = (void.class == returnType || Void.class == returnType)
                && paramCls == Envelop.class;
        InvokerUtil.verify(!valid, returnType, paramCls, getClass());
    }

    @Override
    public void invoke(final Object proxy,
                       final Method method,
                       final Message message) {
        // Invoke directly
        final Envelop envelop = message.body();
        Ut.invoke(proxy, method.getName(), envelop);
        message.reply(Envelop.success(Boolean.TRUE));
    }

    @Override
    public void next(final Object proxy,
                     final Method method,
                     final Message message,
                     final Vertx vertx) {
        // Return void is reject by Rpc continue
        throw new _501RpcRejectException(getClass());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy