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

io.scalecube.services.discovery.api.DiscoveryConfig Maven / Gradle / Ivy

package io.scalecube.services.discovery.api;

import io.scalecube.services.ServiceEndpoint;
import io.scalecube.services.registry.api.ServiceRegistry;
import io.scalecube.transport.Address;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class DiscoveryConfig {

  private Integer port;
  private Address[] seeds;
  private ServiceRegistry serviceRegistry;
  private Map tags;
  private ServiceEndpoint endpoint;

  private DiscoveryConfig(Builder builder) {
    this.seeds = builder.seeds;
    this.serviceRegistry = builder.serviceRegistry;
    this.port = builder.port;
    this.tags = new HashMap<>(builder.tags);
    this.endpoint = builder.endpoint;
  }

  public Integer port() {
    return port;
  }

  public Address[] seeds() {
    return seeds;
  }

  public ServiceRegistry serviceRegistry() {
    return serviceRegistry;
  }

  public Map tags() {
    return this.tags;
  }

  public ServiceEndpoint endpoint() {
    return this.endpoint;
  }

  public static Builder builder() {
    return new Builder();
  }

  public static class Builder {

    private Address[] seeds;
    private Integer port;
    private ServiceRegistry serviceRegistry;
    private Map tags = Collections.emptyMap();
    private ServiceEndpoint endpoint;

    public Builder seeds(Address[] seeds) {
      this.seeds = seeds;
      return this;
    }

    public Builder port(Integer port) {
      this.port = port;
      return this;
    }

    public Builder serviceRegistry(ServiceRegistry serviceRegistry) {
      this.serviceRegistry = serviceRegistry;
      return this;
    }

    public DiscoveryConfig build() {
      return new DiscoveryConfig(this);
    }

    public Builder tags(Map tags) {
      this.tags = tags;
      return this;
    }

    public Builder endpoint(ServiceEndpoint endpoint) {
      this.endpoint = endpoint;
      return this;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy