Class ServiceDiscovery
- java.lang.Object
-
- io.vertx.mutiny.servicediscovery.ServiceDiscovery
-
public class ServiceDiscovery extends Object
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
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
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
NOTE: This class has been automatically generated from theServiceDiscovery
instance. These instances are collaborating in background (distributed structure) to keep the set of services in sync.original
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<ServiceDiscovery>
__TYPE_ARG
static String
EVENT_ID
Constant for id field of usage events.static String
EVENT_RECORD
Constant for record field of usage events.static String
EVENT_TYPE
Constant for type field of usage events.static String
EVENT_TYPE_BIND
Constant for event type `Bind`.static String
EVENT_TYPE_RELEASE
Constant for event type `Release`.
-
Constructor Summary
Constructors Constructor Description ServiceDiscovery(io.vertx.servicediscovery.ServiceDiscovery delegate)
ServiceDiscovery(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<ServiceReference>
bindings()
void
close()
static ServiceDiscovery
create(Vertx vertx)
static ServiceDiscovery
create(Vertx vertx, io.vertx.servicediscovery.ServiceDiscoveryOptions options)
boolean
equals(Object o)
io.vertx.servicediscovery.ServiceDiscovery
getDelegate()
io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record>
getRecord(io.vertx.core.json.JsonObject filter)
Lookups for a single record.io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record>
getRecord(String id)
Looks up for a single record by its registrationid
.io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record>
getRecord(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Lookups for a single record.io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record>
getRecord(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Lookups for a single record.io.vertx.servicediscovery.Record
getRecordAndAwait(io.vertx.core.json.JsonObject filter)
Blocking variant ofgetRecord(JsonObject)
.io.vertx.servicediscovery.Record
getRecordAndAwait(String id)
Blocking variant ofgetRecord(String)
.io.vertx.servicediscovery.Record
getRecordAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Blocking variant ofgetRecord(Function)
.io.vertx.servicediscovery.Record
getRecordAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Blocking variant ofgetRecord(Function,boolean)
.void
getRecordAndForget(io.vertx.core.json.JsonObject filter)
Variant ofgetRecord(JsonObject)
that ignores the result of the operation.void
getRecordAndForget(String id)
Variant ofgetRecord(String)
that ignores the result of the operation.void
getRecordAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Variant ofgetRecord(Function)
that ignores the result of the operation.void
getRecordAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Variant ofgetRecord(Function,boolean)
that ignores the result of the operation.io.smallrye.mutiny.Uni<List<io.vertx.servicediscovery.Record>>
getRecords(io.vertx.core.json.JsonObject filter)
Lookups for a set of records.io.smallrye.mutiny.Uni<List<io.vertx.servicediscovery.Record>>
getRecords(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Lookups for a set of records.io.smallrye.mutiny.Uni<List<io.vertx.servicediscovery.Record>>
getRecords(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Lookups for a set of records.List<io.vertx.servicediscovery.Record>
getRecordsAndAwait(io.vertx.core.json.JsonObject filter)
Blocking variant ofgetRecords(JsonObject)
.List<io.vertx.servicediscovery.Record>
getRecordsAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Blocking variant ofgetRecords(Function)
.List<io.vertx.servicediscovery.Record>
getRecordsAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Blocking variant ofgetRecords(Function,boolean)
.void
getRecordsAndForget(io.vertx.core.json.JsonObject filter)
Variant ofgetRecords(JsonObject)
that ignores the result of the operation.void
getRecordsAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Variant ofgetRecords(Function)
that ignores the result of the operation.void
getRecordsAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Variant ofgetRecords(Function,boolean)
that ignores the result of the operation.ServiceReference
getReference(io.vertx.servicediscovery.Record record)
ServiceReference
getReferenceWithConfiguration(io.vertx.servicediscovery.Record record, io.vertx.core.json.JsonObject configuration)
int
hashCode()
static ServiceDiscovery
newInstance(io.vertx.servicediscovery.ServiceDiscovery arg)
io.vertx.servicediscovery.ServiceDiscoveryOptions
options()
io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record>
publish(io.vertx.servicediscovery.Record record)
Publishes a record.io.vertx.servicediscovery.Record
publishAndAwait(io.vertx.servicediscovery.Record record)
Blocking variant ofpublish(Record)
.void
publishAndForget(io.vertx.servicediscovery.Record record)
Variant ofpublish(Record)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
registerServiceExporter(ServiceExporter exporter, io.vertx.core.json.JsonObject configuration)
Registers a discovery bridge.Void
registerServiceExporterAndAwait(ServiceExporter exporter, io.vertx.core.json.JsonObject configuration)
ServiceDiscovery
registerServiceExporterAndForget(ServiceExporter exporter, io.vertx.core.json.JsonObject configuration)
Variant ofregisterServiceExporter(io.vertx.mutiny.servicediscovery.spi.ServiceExporter,JsonObject)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
registerServiceImporter(ServiceImporter importer, io.vertx.core.json.JsonObject configuration)
Registers a discovery service importer.Void
registerServiceImporterAndAwait(ServiceImporter importer, io.vertx.core.json.JsonObject configuration)
ServiceDiscovery
registerServiceImporterAndForget(ServiceImporter importer, io.vertx.core.json.JsonObject configuration)
Variant ofregisterServiceImporter(io.vertx.mutiny.servicediscovery.spi.ServiceImporter,JsonObject)
that ignores the result of the operation.boolean
release(ServiceReference reference)
static void
releaseServiceObject(ServiceDiscovery discovery, Object svcObject)
String
toString()
io.smallrye.mutiny.Uni<Void>
unpublish(String id)
Un-publishes a record.Void
unpublishAndAwait(String id)
Blocking variant ofunpublish(String)
.void
unpublishAndForget(String id)
Variant ofunpublish(String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record>
update(io.vertx.servicediscovery.Record record)
Updates the given record.io.vertx.servicediscovery.Record
updateAndAwait(io.vertx.servicediscovery.Record record)
Blocking variant ofupdate(Record)
.void
updateAndForget(io.vertx.servicediscovery.Record record)
Variant ofupdate(Record)
that ignores the result of the operation.
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<ServiceDiscovery> __TYPE_ARG
-
EVENT_TYPE
public static final String EVENT_TYPE
Constant for type field of usage events.- See Also:
- Constant Field Values
-
EVENT_TYPE_BIND
public static final String EVENT_TYPE_BIND
Constant for event type `Bind`.- See Also:
- Constant Field Values
-
EVENT_TYPE_RELEASE
public static final String EVENT_TYPE_RELEASE
Constant for event type `Release`.- See Also:
- Constant Field Values
-
EVENT_RECORD
public static final String EVENT_RECORD
Constant for record field of usage events.- See Also:
- Constant Field Values
-
EVENT_ID
public static final String EVENT_ID
Constant for id field of usage events.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServiceDiscovery
public ServiceDiscovery(io.vertx.servicediscovery.ServiceDiscovery delegate)
-
ServiceDiscovery
public ServiceDiscovery(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.servicediscovery.ServiceDiscovery getDelegate()
-
create
public static ServiceDiscovery create(Vertx vertx, io.vertx.servicediscovery.ServiceDiscoveryOptions options)
- Parameters:
vertx
- the vert.x instanceoptions
- the discovery options- Returns:
- the created service discovery instance.
-
create
public static ServiceDiscovery create(Vertx vertx)
- Parameters:
vertx
- the vert.x instance- Returns:
- the created instance
-
getReference
public ServiceReference getReference(io.vertx.servicediscovery.Record record)
- Parameters:
record
- the chosen record- Returns:
- the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.
-
getReferenceWithConfiguration
public ServiceReference getReferenceWithConfiguration(io.vertx.servicediscovery.Record record, io.vertx.core.json.JsonObject configuration)
- Parameters:
record
- the chosen recordconfiguration
- the configuration- Returns:
- the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.
-
release
public boolean release(ServiceReference reference)
- Parameters:
reference
- the reference to release, must not benull
- Returns:
- whether or not the reference has been released.
-
registerServiceImporter
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> registerServiceImporter(ServiceImporter importer, io.vertx.core.json.JsonObject configuration)
Registers a discovery service importer. Importers let you integrate other discovery technologies in this service discovery.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
importer
- the service importerconfiguration
- the optional configuration- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
registerServiceImporterAndAwait
public Void registerServiceImporterAndAwait(ServiceImporter importer, io.vertx.core.json.JsonObject configuration)
Blocking variant ofregisterServiceImporter(io.vertx.mutiny.servicediscovery.spi.ServiceImporter,JsonObject)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
importer
- the service importerconfiguration
- the optional configuration- Returns:
- the Void instance produced by the operation.
-
registerServiceImporterAndForget
public ServiceDiscovery registerServiceImporterAndForget(ServiceImporter importer, io.vertx.core.json.JsonObject configuration)
Variant ofregisterServiceImporter(io.vertx.mutiny.servicediscovery.spi.ServiceImporter,JsonObject)
that ignores the result of the operation.This method subscribes on the result of
registerServiceImporter(io.vertx.mutiny.servicediscovery.spi.ServiceImporter,JsonObject)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromregisterServiceImporter(io.vertx.mutiny.servicediscovery.spi.ServiceImporter,JsonObject)
but you don't need to compose it with other operations.- Parameters:
importer
- the service importerconfiguration
- the optional configuration- Returns:
- the instance of ServiceDiscovery to chain method calls.
-
registerServiceExporter
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> registerServiceExporter(ServiceExporter exporter, io.vertx.core.json.JsonObject configuration)
Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service discovery.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
exporter
- the service exporterconfiguration
- the optional configuration- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
registerServiceExporterAndAwait
public Void registerServiceExporterAndAwait(ServiceExporter exporter, io.vertx.core.json.JsonObject configuration)
Blocking variant ofregisterServiceExporter(io.vertx.mutiny.servicediscovery.spi.ServiceExporter,JsonObject)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
exporter
- the service exporterconfiguration
- the optional configuration- Returns:
- the Void instance produced by the operation.
-
registerServiceExporterAndForget
public ServiceDiscovery registerServiceExporterAndForget(ServiceExporter exporter, io.vertx.core.json.JsonObject configuration)
Variant ofregisterServiceExporter(io.vertx.mutiny.servicediscovery.spi.ServiceExporter,JsonObject)
that ignores the result of the operation.This method subscribes on the result of
registerServiceExporter(io.vertx.mutiny.servicediscovery.spi.ServiceExporter,JsonObject)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromregisterServiceExporter(io.vertx.mutiny.servicediscovery.spi.ServiceExporter,JsonObject)
but you don't need to compose it with other operations.- Parameters:
exporter
- the service exporterconfiguration
- the optional configuration- Returns:
- the instance of ServiceDiscovery to chain method calls.
-
close
public void close()
-
publish
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record> publish(io.vertx.servicediscovery.Record record)
Publishes a record.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
record
- the record- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
publishAndAwait
public io.vertx.servicediscovery.Record publishAndAwait(io.vertx.servicediscovery.Record record)
Blocking variant ofpublish(Record)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
record
- the record- Returns:
- the Record instance produced by the operation.
-
publishAndForget
public void publishAndForget(io.vertx.servicediscovery.Record record)
Variant ofpublish(Record)
that ignores the result of the operation.This method subscribes on the result of
publish(Record)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompublish(Record)
but you don't need to compose it with other operations.- Parameters:
record
- the record
-
unpublish
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> unpublish(String id)
Un-publishes a record.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
id
- the registration id- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
unpublishAndAwait
public Void unpublishAndAwait(String id)
Blocking variant ofunpublish(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
id
- the registration id- Returns:
- the Void instance produced by the operation.
-
unpublishAndForget
public void unpublishAndForget(String id)
Variant ofunpublish(String)
that ignores the result of the operation.This method subscribes on the result of
unpublish(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromunpublish(String)
but you don't need to compose it with other operations.- Parameters:
id
- the registration id
-
getRecord
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record> getRecord(io.vertx.core.json.JsonObject filter)
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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
filter
- the filter.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getRecordAndAwait
public io.vertx.servicediscovery.Record getRecordAndAwait(io.vertx.core.json.JsonObject filter)
Blocking variant ofgetRecord(JsonObject)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filter
- the filter.- Returns:
- the Record instance produced by the operation.
-
getRecordAndForget
public void getRecordAndForget(io.vertx.core.json.JsonObject filter)
Variant ofgetRecord(JsonObject)
that ignores the result of the operation.This method subscribes on the result of
getRecord(JsonObject)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetRecord(JsonObject)
but you don't need to compose it with other operations.- Parameters:
filter
- the filter.
-
getRecord
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record> getRecord(String id)
Looks up for a single record by its registrationid
.When there are no matching record, the operation succeeds, but the async result has no result (
null
).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
id
- the registration id- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getRecordAndAwait
public io.vertx.servicediscovery.Record getRecordAndAwait(String id)
Blocking variant ofgetRecord(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
id
- the registration id- Returns:
- the Record instance produced by the operation.
-
getRecordAndForget
public void getRecordAndForget(String id)
Variant ofgetRecord(String)
that ignores the result of the operation.This method subscribes on the result of
getRecord(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetRecord(String)
but you don't need to compose it with other operations.- Parameters:
id
- the registration id
-
getRecord
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record> getRecord(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Lookups for a single record.The filter is a taking a
Record
as argument and returning a boolean. You should see it as anaccept
method of a filter. This method return a record passing the filter.This method only looks for records with a
UP
status.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all records- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getRecordAndAwait
public io.vertx.servicediscovery.Record getRecordAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Blocking variant ofgetRecord(Function)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all records- Returns:
- the Record instance produced by the operation.
-
getRecordAndForget
public void getRecordAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Variant ofgetRecord(Function)
that ignores the result of the operation.This method subscribes on the result of
getRecord(Function)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetRecord(Function)
but you don't need to compose it with other operations.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all records
-
getRecord
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record> getRecord(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Lookups for a single record.The filter is a taking a
Record
as argument and returning a boolean. You should see it as anaccept
method of a filter. This method return a record passing the filter.Unlike
getRecord(io.vertx.core.json.JsonObject)
, this method may accept records with aOUT OF SERVICE
status, if theincludeOutOfService
parameter is set totrue
.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all recordsincludeOutOfService
- whether or not the filter acceptsOUT OF SERVICE
records- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getRecordAndAwait
public io.vertx.servicediscovery.Record getRecordAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Blocking variant ofgetRecord(Function,boolean)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all recordsincludeOutOfService
- whether or not the filter acceptsOUT OF SERVICE
records- Returns:
- the Record instance produced by the operation.
-
getRecordAndForget
public void getRecordAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Variant ofgetRecord(Function,boolean)
that ignores the result of the operation.This method subscribes on the result of
getRecord(Function,boolean)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetRecord(Function,boolean)
but you don't need to compose it with other operations.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all recordsincludeOutOfService
- whether or not the filter acceptsOUT OF SERVICE
records
-
getRecords
@CheckReturnValue public io.smallrye.mutiny.Uni<List<io.vertx.servicediscovery.Record>> getRecords(io.vertx.core.json.JsonObject filter)
Lookups for a set of records. UnlikegetRecord(io.vertx.core.json.JsonObject)
, this method returns all matching records.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
filter
- the filter - seegetRecord(io.vertx.core.json.JsonObject)
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getRecordsAndAwait
public List<io.vertx.servicediscovery.Record> getRecordsAndAwait(io.vertx.core.json.JsonObject filter)
Blocking variant ofgetRecords(JsonObject)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filter
- the filter - seegetRecord(io.vertx.core.json.JsonObject)
- Returns:
- the List
instance produced by the operation.
-
getRecordsAndForget
public void getRecordsAndForget(io.vertx.core.json.JsonObject filter)
Variant ofgetRecords(JsonObject)
that ignores the result of the operation.This method subscribes on the result of
getRecords(JsonObject)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetRecords(JsonObject)
but you don't need to compose it with other operations.- Parameters:
filter
- the filter - seegetRecord(io.vertx.core.json.JsonObject)
-
getRecords
@CheckReturnValue public io.smallrye.mutiny.Uni<List<io.vertx.servicediscovery.Record>> getRecords(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Lookups for a set of records. UnlikegetRecord(io.vertx.core.json.JsonObject)
, this method returns all matching records.The filter is a taking a
Record
as argument and returning a boolean. You should see it as anaccept
method of a filter. This method return a record passing the filter.This method only looks for records with a
UP
status.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all records- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getRecordsAndAwait
public List<io.vertx.servicediscovery.Record> getRecordsAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Blocking variant ofgetRecords(Function)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all records- Returns:
- the List
instance produced by the operation.
-
getRecordsAndForget
public void getRecordsAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter)
Variant ofgetRecords(Function)
that ignores the result of the operation.This method subscribes on the result of
getRecords(Function)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetRecords(Function)
but you don't need to compose it with other operations.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all records
-
getRecords
@CheckReturnValue public io.smallrye.mutiny.Uni<List<io.vertx.servicediscovery.Record>> getRecords(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Lookups for a set of records. UnlikegetRecord(io.vertx.core.json.JsonObject)
, this method returns all matching records.The filter is a taking a
Record
as argument and returning a boolean. You should see it as anaccept
method of a filter. This method return a record passing the filter.Unlike
getRecords(io.vertx.core.json.JsonObject)
, this method may accept records with aOUT OF SERVICE
status, if theincludeOutOfService
parameter is set totrue
.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all recordsincludeOutOfService
- whether or not the filter acceptsOUT OF SERVICE
records- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getRecordsAndAwait
public List<io.vertx.servicediscovery.Record> getRecordsAndAwait(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Blocking variant ofgetRecords(Function,boolean)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all recordsincludeOutOfService
- whether or not the filter acceptsOUT OF SERVICE
records- Returns:
- the List
instance produced by the operation.
-
getRecordsAndForget
public void getRecordsAndForget(Function<io.vertx.servicediscovery.Record,Boolean> filter, boolean includeOutOfService)
Variant ofgetRecords(Function,boolean)
that ignores the result of the operation.This method subscribes on the result of
getRecords(Function,boolean)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetRecords(Function,boolean)
but you don't need to compose it with other operations.- Parameters:
filter
- the filter, must not benull
. To return all records, use a function accepting all recordsincludeOutOfService
- whether or not the filter acceptsOUT OF SERVICE
records
-
update
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.servicediscovery.Record> update(io.vertx.servicediscovery.Record record)
Updates the given record. The record must has been published, and has it's registration id set.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
record
- the updated record- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
updateAndAwait
public io.vertx.servicediscovery.Record updateAndAwait(io.vertx.servicediscovery.Record record)
Blocking variant ofupdate(Record)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
record
- the updated record- Returns:
- the Record instance produced by the operation.
-
updateAndForget
public void updateAndForget(io.vertx.servicediscovery.Record record)
Variant ofupdate(Record)
that ignores the result of the operation.This method subscribes on the result of
update(Record)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromupdate(Record)
but you don't need to compose it with other operations.- Parameters:
record
- the updated record
-
bindings
public Set<ServiceReference> bindings()
- Returns:
- the set of service references retrieved by this service discovery.
-
options
public io.vertx.servicediscovery.ServiceDiscoveryOptions options()
- Returns:
- the discovery options. Modifying the returned object would not update the discovery service configuration. This object should be considered as read-only.
-
releaseServiceObject
public static void releaseServiceObject(ServiceDiscovery discovery, Object svcObject)
- Parameters:
discovery
- the service discoverysvcObject
- the service object
-
newInstance
public static ServiceDiscovery newInstance(io.vertx.servicediscovery.ServiceDiscovery arg)
-
-