Class Lookup

java.lang.Object
org.apache.pekko.discovery.Lookup
All Implemented Interfaces:
NoSerializationVerificationNeeded

public final class Lookup extends Object implements NoSerializationVerificationNeeded
A service lookup. It is up to each method to decide what to do with the optional portName and protocol fields. For example portName could be used to distinguish between Apache Pekko remoting ports and HTTP ports.

param: serviceName must not be 'null' or an empty String

  • Constructor Details

    • Lookup

      public Lookup(String serviceName, scala.Option<String> portName, scala.Option<String> protocol)
  • Method Details

    • apply

      public static Lookup apply(String serviceName)
      Create a service Lookup with only a serviceName. Use withPortName and withProtocol to provide optional portName and protocol
    • apply

      public static Lookup apply(String serviceName, scala.Option<String> portName, scala.Option<String> protocol)
      Create a service Lookup with serviceName, optional portName and optional protocol.
    • create

      public static Lookup create(String serviceName)
      Java API

      Create a service Lookup with only a serviceName. Use withPortName and withProtocol to provide optional portName and protocol

    • parseSrv

      public static Lookup parseSrv(String str)
      Create a service Lookup from a string with format: _portName._protocol.serviceName. (as specified by https://www.ietf.org/rfc/rfc2782.txt)

      If the passed string conforms with this format, a SRV Lookup is returned. The serviceName part must be a valid domain name. (as defined in https://tools.ietf.org/html/rfc1034)

      The string is parsed and dismembered to build a Lookup as following: Lookup(serviceName).withPortName(portName).withProtocol(protocol)

      Throws:
      NullPointerException - If the passed string is null
      IllegalArgumentException - If the string doesn't not conform with the SRV format
    • isValidSrv

      public static boolean isValidSrv(String srv)
      Returns true if passed string conforms with SRV format. Otherwise returns false.
    • productPrefix

      public static String productPrefix()
    • productArity

      public static int productArity()
    • productElement

      public static Object productElement(int x$1)
    • productIterator

      public static scala.collection.Iterator<Object> productIterator()
    • canEqual

      public static boolean canEqual(Object x$1)
    • productElementName

      public static String productElementName(int n)
    • productElementNames

      public static scala.collection.Iterator<String> productElementNames()
    • serviceName

      public String serviceName()
    • portName

      public scala.Option<String> portName()
    • protocol

      public scala.Option<String> protocol()
    • withPortName

      public Lookup withPortName(String value)
      Which port for a service e.g. Apache Pekko remoting or HTTP. Maps to "service" for an SRV records.
    • withProtocol

      public Lookup withProtocol(String value)
      Which protocol e.g. TCP or UDP. Maps to "protocol" for SRV records.
    • getPortName

      public Optional<String> getPortName()
      Java API
    • getProtocol

      public Optional<String> getProtocol()
      Java API
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object