Package io.vertx.servicediscovery.spi
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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
getRecord(String uuid, Handler<AsyncResult<Record>> resultHandler)
Get the record with the given uuid.void
getRecords(Handler<AsyncResult<List<Record>>> resultHandler)
Gets all the recordsvoid
init(Vertx vertx, JsonObject config)
Initializes the backend.default String
name()
void
remove(Record record, Handler<AsyncResult<Record>> resultHandler)
Removes a record.void
remove(String uuid, Handler<AsyncResult<Record>> resultHandler)
Removes a records based on its UUID.void
store(Record record, Handler<AsyncResult<Record>> resultHandler)
Stores a record.void
update(Record record, Handler<AsyncResult<Void>> resultHandler)
Updates a record
-
-
-
Method Detail
-
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 instanceconfig
- the configuration if any.
-
store
void store(Record record, Handler<AsyncResult<Record>> resultHandler)
Stores a record.- Parameters:
record
- the recordresultHandler
- the completion handler
-
remove
void remove(Record record, Handler<AsyncResult<Record>> resultHandler)
Removes a record.- Parameters:
record
- the recordresultHandler
- the completion handler
-
remove
void remove(String uuid, Handler<AsyncResult<Record>> resultHandler)
Removes a records based on its UUID.- Parameters:
uuid
- the uuid / registration idresultHandler
- the completion handler
-
update
void update(Record record, Handler<AsyncResult<Void>> resultHandler)
Updates a record- Parameters:
record
- the record to updateresultHandler
- 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 idresultHandler
- the result handler
-
-