vertx-lang-scala-docs_2.12 3.4.0 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package servicediscovery
  Definition Classes
    scala
-  package spi
  Definition Classes
    servicediscovery
-  package types
  Definition Classes
    servicediscovery
- Record
- ServiceDiscovery
- ServiceDiscoveryOptions
- ServiceReference

c

io.vertx.scala.servicediscovery

# ServiceDiscovery 

###
Companion object ServiceDiscovery

#### class ServiceDiscovery extends AnyRef

Service Discovery main entry point.

The service discovery is an infrastructure that let you publish and find `services`. A `service` is a discoverable functionality. It can be qualified by its type, metadata, and location. So a `service` can be a database, a service proxy, a HTTP endpoint. It does not have to be a vert.x entity, but can be anything. Each service is described by a Record.

The service discovery implements the interactions defined in the service-oriented computing. And to some extend, also provides the dynamic service-oriented computing interaction. So, application can react to arrival and departure of services.

A service provider can:

* publish a service record * un-publish a published record * update the status of a published service (down, out of service...)

A service consumer can:

* lookup for services * bind to a selected service (it gets a io.vertx.scala.servicediscovery.ServiceReference) and use it * release the service once the consumer is done with it * listen for arrival, departure and modification of services.

Consumer would 1) lookup for service record matching their need, 2) retrieve the io.vertx.scala.servicediscovery.ServiceReference that give access to the service, 3) get a service object to access the service, 4) release the service object once done.

A state above, the central piece of information shared by the providers and consumers are Record.

Providers and consumers must create their own io.vertx.scala.servicediscovery.ServiceDiscovery instance. These instances are collaborating in background (distributed structure) to keep the set of services in sync.

Linear Supertypes
AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. ServiceDiscovery
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new ServiceDiscovery(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
6.  def bindings(): Set[ServiceReference]

   returns

     the set of service references retrieved by this service discovery.

7.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... )
8.  def close(): Unit

   Closes the service discovery

9.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
10.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
11.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
12.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
13.  def getRecord(filter: (Record) ⇒ Boolean, includeOutOfService: Boolean, resultHandler: Handler[AsyncResult[Record]]): Unit

    Lookups for a single record.

    Lookups for a single record.

    The filter is a taking a Record as argument and returning a boolean. You should see it as an `accept` method of a filter. This method return a record passing the filter.

    Unlike io.vertx.scala.servicediscovery.ServiceDiscovery#getRecordFuture, this method may accept records with a `OUT OF SERVICE` status, if the `includeOutOfService` parameter is set to `true`.

    filter

      the filter, must not be `null`. To return all records, use a function accepting all records

    includeOutOfService

      whether or not the filter accepts `OUT OF SERVICE` records

    resultHandler

      the result handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has no result.

14.  def getRecord(filter: (Record) ⇒ Boolean, resultHandler: Handler[AsyncResult[Record]]): Unit

    Lookups for a single record.

    Lookups for a single record.

    The filter is a taking a Record as argument and returning a boolean. You should see it as an `accept` method of a filter. This method return a record passing the filter.

    This method only looks for records with a `UP` status.

    filter

      the filter, must not be `null`. To return all records, use a function accepting all records

    resultHandler

      the result handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has no result.

15.  def getRecord(filter: JsonObject, resultHandler: Handler[AsyncResult[Record]]): Unit

    Lookups for a single record.

    Lookups for a single record.

    Filters are expressed using a Json object. Each entry of the given filter will be checked against the record. All entry must match exactly the record. The entry can use the special "*" value to denotes a requirement on the key, but not on the value.

    Let's take some example:

          { "name" = "a" ` => matches records with name set fo "a"
          { "color" = "*" ` => matches records with "color" set
          { "color" = "red" ` => only matches records with "color" set to "red"
          { "color" = "red", "name" = "a"` => only matches records with name set to "a", and color set to "red"

    If the filter is not set (`null` or empty), it accepts all records.

    This method returns the first matching record.

    filter

      the filter.

    resultHandler

      handler called when the lookup has been completed. When there are no matching record, the operation succeeds, but the async result has no result (`null`).

16.  def getRecordFuture(filter: (Record) ⇒ Boolean, includeOutOfService: Boolean): Future[Record]

    Like getRecord but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

17.  def getRecordFuture(filter: (Record) ⇒ Boolean): Future[Record]

    Like getRecord but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

18.  def getRecordFuture(filter: JsonObject): Future[Record]

    Like getRecord but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

19.  def getRecords(filter: (Record) ⇒ Boolean, includeOutOfService: Boolean, resultHandler: Handler[AsyncResult[Buffer[Record]]]): Unit

    Lookups for a set of records.

    Lookups for a set of records. Unlike io.vertx.scala.servicediscovery.ServiceDiscovery#getRecordFuture, this method returns all matching records.

    The filter is a taking a Record as argument and returning a boolean. You should see it as an `accept` method of a filter. This method return a record passing the filter.

    Unlike io.vertx.scala.servicediscovery.ServiceDiscovery#getRecordsFuture, this method may accept records with a `OUT OF SERVICE` status, if the `includeOutOfService` parameter is set to `true`.

    filter

      the filter, must not be `null`. To return all records, use a function accepting all records

    includeOutOfService

      whether or not the filter accepts `OUT OF SERVICE` records

    resultHandler

      handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result.

20.  def getRecords(filter: (Record) ⇒ Boolean, resultHandler: Handler[AsyncResult[Buffer[Record]]]): Unit

    Lookups for a set of records.

    Lookups for a set of records. Unlike io.vertx.scala.servicediscovery.ServiceDiscovery#getRecordFuture, this method returns all matching records.

    The filter is a taking a Record as argument and returning a boolean. You should see it as an `accept` method of a filter. This method return a record passing the filter.

    This method only looks for records with a `UP` status.

    filter

      the filter, must not be `null`. To return all records, use a function accepting all records

    resultHandler

      handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result.

21.  def getRecords(filter: JsonObject, resultHandler: Handler[AsyncResult[Buffer[Record]]]): Unit

    Lookups for a set of records.

    Lookups for a set of records. Unlike io.vertx.scala.servicediscovery.ServiceDiscovery#getRecordFuture, this method returns all matching records.

    filter

      the filter - see #getRecord(JsonObject, Handler)

    resultHandler

      handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result.

22.  def getRecordsFuture(filter: (Record) ⇒ Boolean, includeOutOfService: Boolean): Future[Buffer[Record]]

    Like getRecords but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

23.  def getRecordsFuture(filter: (Record) ⇒ Boolean): Future[Buffer[Record]]

    Like getRecords but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

24.  def getRecordsFuture(filter: JsonObject): Future[Buffer[Record]]

    Like getRecords but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

25.  def getReference(record: Record): ServiceReference

    Gets a service reference from the given record.

    Gets a service reference from the given record.

    record

      the chosen recordsee Record

    returns

      the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.

26.  def getReferenceWithConfiguration(record: Record, configuration: JsonObject): ServiceReference

    Gets a service reference from the given record, the reference is configured with the given json object.

    Gets a service reference from the given record, the reference is configured with the given json object.

    record

      the chosen recordsee Record

    configuration

      the configuration

    returns

      the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.

27.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
28.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
29.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
30.  final def notify(): Unit
    Definition Classes
      AnyRef
31.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
32.  def options(): ServiceDiscoveryOptions

    returns

      the discovery options. Modifying the returned object would not update the discovery service configuration. This object should be considered as read-only.see ServiceDiscoveryOptions

33.  def publish(record: Record, resultHandler: Handler[AsyncResult[Record]]): Unit

    Publishes a record.

    Publishes a record.

    record

      the recordsee Record

    resultHandler

      handler called when the operation has completed (successfully or not). In case of success, the passed record has a registration id required to modify and un-register the service.

34.  def publishFuture(record: Record): Future[Record]

    Like publish but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

35.  def registerServiceExporter(exporter: ServiceExporter, configuration: JsonObject, completionHandler: Handler[AsyncResult[Unit]]): ServiceDiscovery

    Registers a discovery bridge.

    Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service discovery.

    exporter

      the service exporter

    configuration

      the optional configuration

    completionHandler

      handler notified when the exporter has been correctly initialized.

    returns

      the current ServiceDiscovery

36.  def registerServiceExporter(exporter: ServiceExporter, configuration: JsonObject): ServiceDiscovery

    Registers a discovery bridge.

    Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service discovery.

    exporter

      the service exporter

    configuration

      the optional configuration

    returns

      the current ServiceDiscovery

37.  def registerServiceExporterFuture(exporter: ServiceExporter, configuration: JsonObject): Future[Unit]

    Like registerServiceExporter but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

38.  def registerServiceImporter(importer: ServiceImporter, configuration: JsonObject, completionHandler: Handler[AsyncResult[Unit]]): ServiceDiscovery

    Registers a discovery service importer.

    Registers a discovery service importer. Importers let you integrate other discovery technologies in this service discovery.

    importer

      the service importer

    configuration

      the optional configuration

    completionHandler

      handler call when the importer has finished its initialization and initial imports

    returns

      the current ServiceDiscovery

39.  def registerServiceImporter(importer: ServiceImporter, configuration: JsonObject): ServiceDiscovery

    Registers a discovery service importer.

    Registers a discovery service importer. Importers let you integrate other discovery technologies in this service discovery.

    importer

      the service importer

    configuration

      the optional configuration

    returns

      the current ServiceDiscovery

40.  def registerServiceImporterFuture(importer: ServiceImporter, configuration: JsonObject): Future[Unit]

    Like registerServiceImporter but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

41.  def release(reference: ServiceReference): Boolean

    Releases the service reference.

    Releases the service reference.

    reference

      the reference to release, must not be `null`

    returns

      whether or not the reference has been released.

42.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
43.  def toString(): String
    Definition Classes
      AnyRef → Any
44.  def unpublish(id: String, resultHandler: Handler[AsyncResult[Unit]]): Unit

    Un-publishes a record.

    Un-publishes a record.

    id

      the registration id

    resultHandler

      handler called when the operation has completed (successfully or not).

45.  def unpublishFuture(id: String): Future[Unit]

    Like unpublish but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

46.  def update(record: Record, resultHandler: Handler[AsyncResult[Record]]): Unit

    Updates the given record.

    Updates the given record. The record must has been published, and has it's registration id set.

    record

      the updated recordsee Record

    resultHandler

      handler called when the lookup has been completed.

47.  def updateFuture(record: Record): Future[Record]

    Like update but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

48.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
49.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
50.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

### Inherited from AnyRef

### Inherited from Any

### Ungrouped