new ServiceDiscovery()
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
- Source:
Methods
bindings() → {Array.<ServiceReference>}
- Source:
Returns:
close()
Closes the service discovery
- Source:
getRecord(filter, includeOutOfService, resultHandler)
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 ServiceDiscovery#getRecord, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Parameters:
Name |
Type |
Description |
filter |
todo
|
the filter, must not be null . To return all records, use a function accepting all records |
includeOutOfService |
boolean
|
whether or not the filter accepts OUT OF SERVICE records |
resultHandler |
function
|
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. |
- Source:
getRecords(filter, includeOutOfService, resultHandler)
Lookups for a set of records. Unlike ServiceDiscovery#getRecord, 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 ServiceDiscovery#getRecords, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Parameters:
Name |
Type |
Description |
filter |
todo
|
the filter, must not be null . To return all records, use a function accepting all records |
includeOutOfService |
boolean
|
whether or not the filter accepts OUT OF SERVICE records |
resultHandler |
function
|
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. |
- Source:
getReference(record) → {ServiceReference}
Gets a service reference from the given record.
Parameters:
Name |
Type |
Description |
record |
Object
|
the chosen record |
- Source:
Returns:
the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.
-
Type
-
ServiceReference
getReferenceWithConfiguration(record, configuration) → {ServiceReference}
Gets a service reference from the given record, the reference is configured with the given json object.
Parameters:
Name |
Type |
Description |
record |
Object
|
the chosen record |
configuration |
Object
|
the configuration |
- Source:
Returns:
the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.
-
Type
-
ServiceReference
publish(record, resultHandler)
Publishes a record.
Parameters:
Name |
Type |
Description |
record |
Object
|
the record |
resultHandler |
function
|
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. |
- Source:
registerServiceExporter(exporter, configuration) → {ServiceDiscovery}
Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service
discovery.
Parameters:
Name |
Type |
Description |
exporter |
ServiceExporter
|
the service exporter |
configuration |
Object
|
the optional configuration |
- Source:
Returns:
the current ServiceDiscovery
-
Type
-
ServiceDiscovery
registerServiceImporter(importer, configuration) → {ServiceDiscovery}
Registers a discovery service importer. Importers let you integrate other discovery technologies in this service
discovery.
Parameters:
Name |
Type |
Description |
importer |
ServiceImporter
|
the service importer |
configuration |
Object
|
the optional configuration |
- Source:
Returns:
the current ServiceDiscovery
-
Type
-
ServiceDiscovery
release(reference) → {boolean}
Releases the service reference.
Parameters:
Name |
Type |
Description |
reference |
ServiceReference
|
the reference to release, must not be null |
- Source:
Returns:
whether or not the reference has been released.
-
Type
-
boolean
unpublish(id, resultHandler)
Un-publishes a record.
Parameters:
Name |
Type |
Description |
id |
string
|
the registration id |
resultHandler |
function
|
handler called when the operation has completed (successfully or not). |
- Source:
update(record, resultHandler)
Updates the given record. The record must has been published, and has it's registration id set.
Parameters:
Name |
Type |
Description |
record |
Object
|
the updated record |
resultHandler |
function
|
handler called when the lookup has been completed. |
- Source: