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

as.leap.vertx.rpc.impl.RPCServerOptions Maven / Gradle / Ivy

There is a newer version: 3.3.8
Show newest version
package as.leap.vertx.rpc.impl;


import io.vertx.core.Vertx;
import io.vertx.core.shareddata.LocalMap;

/**
 *
 */
public class RPCServerOptions {

  private Vertx vertx;
  private String busAddress;
  private int maxBufferedMessages;
  LocalMap serviceMapping;
  private static final String SERVICE_MAP_NAME = "VERTX_RPC_SERVICE";

  public RPCServerOptions(Vertx vertx) {
    this.vertx = vertx;
    this.serviceMapping = vertx.sharedData().getLocalMap(SERVICE_MAP_NAME);
  }

  public RPCServerOptions(Vertx vertx, RPCServerOptions other) {
    this.vertx = vertx;
    this.busAddress = other.getBusAddress();
    this.serviceMapping = vertx.sharedData().getLocalMap(SERVICE_MAP_NAME);
  }

  LocalMap getServiceMapping() {
    return serviceMapping;
  }

  public RPCServerOptions addService(Object service) {
    serviceMapping.put(service.getClass().getInterfaces()[0].getCanonicalName(), new SharedWrapper<>(service));
    return this;
  }

  public int getMaxBufferedMessages() {
    return maxBufferedMessages;
  }

  public RPCServerOptions setMaxBufferedMessages(int maxBufferedMessages) {
    this.maxBufferedMessages = maxBufferedMessages;
    return this;
  }

  public Vertx getVertx() {
    return vertx;
  }

  public RPCServerOptions setBusAddress(String busAddress) {
    this.busAddress = busAddress;
    return this;
  }

  public String getBusAddress() {
    return busAddress;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy