Interface ServiceDiscoveryBackend

All Known Implementing Classes:
RedisBackendService

public interface ServiceDiscoveryBackend
By default the service discovery uses a distributed map to store the records. But this backend can be replaced. To replace a backend implement this interface and configure the SPI to point to your implementation.

check DefaultServiceDiscoveryBackend for more details.

Author:
Clement Escoffier
  • Method Details

    • name

      default String name()
      Returns:
      the name of the implementation, used to select the right one (when there are several implementation on the classpath). By default it ruturns the class name of the implementation (as String).
    • init

      void init(Vertx vertx, JsonObject config)
      Initializes the backend.
      Parameters:
      vertx - the vert.x instance
      config - the configuration if any.
    • store

      void store(Record record, Handler<AsyncResult<Record>> resultHandler)
      Stores a record.
      Parameters:
      record - the record
      resultHandler - the completion handler
    • remove

      void remove(Record record, Handler<AsyncResult<Record>> resultHandler)
      Removes a record.
      Parameters:
      record - the record
      resultHandler - the completion handler
    • remove

      void remove(String uuid, Handler<AsyncResult<Record>> resultHandler)
      Removes a records based on its UUID.
      Parameters:
      uuid - the uuid / registration id
      resultHandler - the completion handler
    • update

      void update(Record record, Handler<AsyncResult<Void>> resultHandler)
      Updates a record
      Parameters:
      record - the record to update
      resultHandler - the completion handler
    • getRecords

      void getRecords(Handler<AsyncResult<List<Record>>> resultHandler)
      Gets all the records
      Parameters:
      resultHandler - the result handler
    • getRecord

      void getRecord(String uuid, Handler<AsyncResult<Record>> resultHandler)
      Get the record with the given uuid.
      Parameters:
      uuid - the uuid / registration id
      resultHandler - the result handler