/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.vertx.reactivex.servicediscovery;
import io.vertx.reactivex.RxHelper;
import io.vertx.reactivex.ObservableHelper;
import io.vertx.reactivex.FlowableHelper;
import io.vertx.reactivex.impl.AsyncResultMaybe;
import io.vertx.reactivex.impl.AsyncResultSingle;
import io.vertx.reactivex.impl.AsyncResultCompletable;
import io.vertx.reactivex.WriteStreamObserver;
import io.vertx.reactivex.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;
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 ServiceDiscovery
instance. These instances are collaborating in background (distributed structure) to keep the set of services in sync.
NOTE: This class has been automatically generated from the original
non RX-ified interface using Vert.x codegen. /**
* Service Discovery main entry point.
* <p>
* 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 {@link io.vertx.servicediscovery.Record}.
* <p>
* 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.
* <p>
* A service provider can:
* <p>
* * publish a service record
* * un-publish a published record
* * update the status of a published service (down, out of service...)
* <p>
* A service consumer can:
* <p>
* * lookup for services
* * bind to a selected service (it gets a {@link io.vertx.reactivex.servicediscovery.ServiceReference}) and use it
* * release the service once the consumer is done with it
* * listen for arrival, departure and modification of services.
* <p>
* Consumer would 1) lookup for service record matching their need, 2) retrieve the {@link io.vertx.reactivex.servicediscovery.ServiceReference} that give access
* to the service, 3) get a service object to access the service, 4) release the service object once done.
* <p>
* A state above, the central piece of information shared by the providers and consumers are {@link io.vertx.servicediscovery.Record}.
* <p>
* Providers and consumers must create their own {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery} instance. These instances are collaborating
* in background (distributed structure) to keep the set of services in sync.
*
* <p/>
* NOTE: This class has been automatically generated from the {@link io.vertx.servicediscovery.ServiceDiscovery original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.servicediscovery.ServiceDiscovery.class)
public class ServiceDiscovery {
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ServiceDiscovery that = (ServiceDiscovery) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg<ServiceDiscovery> __TYPE_ARG = new TypeArg<>( obj -> new ServiceDiscovery((io.vertx.servicediscovery.ServiceDiscovery) obj),
ServiceDiscovery::getDelegate
);
private final io.vertx.servicediscovery.ServiceDiscovery delegate;
public ServiceDiscovery(io.vertx.servicediscovery.ServiceDiscovery delegate) {
this.delegate = delegate;
}
public ServiceDiscovery(Object delegate) {
this.delegate = (io.vertx.servicediscovery.ServiceDiscovery)delegate;
}
public io.vertx.servicediscovery.ServiceDiscovery getDelegate() {
return delegate;
}
private static final TypeArg<io.vertx.reactivex.servicediscovery.ServiceReference> TYPE_ARG_0 = new TypeArg<io.vertx.reactivex.servicediscovery.ServiceReference>(o1 -> io.vertx.reactivex.servicediscovery.ServiceReference.newInstance((io.vertx.servicediscovery.ServiceReference)o1), o1 -> o1.getDelegate());
Creates an instance of ServiceDiscovery
. Params: - vertx – the vert.x instance
- options – the discovery options
Returns: the created service discovery instance.
/**
* Creates an instance of {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery}.
* @param vertx the vert.x instance
* @param options the discovery options
* @return the created service discovery instance.
*/
public static io.vertx.reactivex.servicediscovery.ServiceDiscovery create(io.vertx.reactivex.core.Vertx vertx, io.vertx.servicediscovery.ServiceDiscoveryOptions options) {
io.vertx.reactivex.servicediscovery.ServiceDiscovery ret = io.vertx.reactivex.servicediscovery.ServiceDiscovery.newInstance((io.vertx.servicediscovery.ServiceDiscovery)io.vertx.servicediscovery.ServiceDiscovery.create(vertx.getDelegate(), options));
return ret;
}
Creates a new instance of ServiceDiscovery
using the default configuration. Params: - vertx – the vert.x instance
Returns: the created instance
/**
* Creates a new instance of {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery} using the default configuration.
* @param vertx the vert.x instance
* @return the created instance
*/
public static io.vertx.reactivex.servicediscovery.ServiceDiscovery create(io.vertx.reactivex.core.Vertx vertx) {
io.vertx.reactivex.servicediscovery.ServiceDiscovery ret = io.vertx.reactivex.servicediscovery.ServiceDiscovery.newInstance((io.vertx.servicediscovery.ServiceDiscovery)io.vertx.servicediscovery.ServiceDiscovery.create(vertx.getDelegate()));
return ret;
}
Gets a service reference from the given record.
Params: - 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.
/**
* Gets a service reference from the given record.
* @param record the chosen record
* @return the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.
*/
public io.vertx.reactivex.servicediscovery.ServiceReference getReference(io.vertx.servicediscovery.Record record) {
io.vertx.reactivex.servicediscovery.ServiceReference ret = io.vertx.reactivex.servicediscovery.ServiceReference.newInstance((io.vertx.servicediscovery.ServiceReference)delegate.getReference(record));
return ret;
}
Gets a service reference from the given record, the reference is configured with the given json object.
Params: - record – the chosen 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.
/**
* Gets a service reference from the given record, the reference is configured with the given json object.
* @param record the chosen record
* @param configuration the configuration
* @return the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.
*/
public io.vertx.reactivex.servicediscovery.ServiceReference getReferenceWithConfiguration(io.vertx.servicediscovery.Record record, JsonObject configuration) {
io.vertx.reactivex.servicediscovery.ServiceReference ret = io.vertx.reactivex.servicediscovery.ServiceReference.newInstance((io.vertx.servicediscovery.ServiceReference)delegate.getReferenceWithConfiguration(record, configuration));
return ret;
}
Releases the service reference.
Params: - reference – the reference to release, must not be
null
Returns: whether or not the reference has been released.
/**
* Releases the service reference.
* @param reference the reference to release, must not be <code>null</code>
* @return whether or not the reference has been released.
*/
public boolean release(io.vertx.reactivex.servicediscovery.ServiceReference reference) {
boolean ret = delegate.release(reference.getDelegate());
return ret;
}
Registers a discovery service importer. Importers let you integrate other discovery technologies in this service
discovery.
Params: - 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
/**
* Registers a discovery service importer. Importers let you integrate other discovery technologies in this service
* discovery.
* @param importer the service importer
* @param configuration the optional configuration
* @param completionHandler handler call when the importer has finished its initialization and initial imports
* @return the current {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery}
*/
public io.vertx.reactivex.servicediscovery.ServiceDiscovery registerServiceImporter(io.vertx.reactivex.servicediscovery.spi.ServiceImporter importer, JsonObject configuration, Handler<AsyncResult<Void>> completionHandler) {
delegate.registerServiceImporter(importer.getDelegate(), configuration, completionHandler);
return this;
}
Registers a discovery service importer. Importers let you integrate other discovery technologies in this service
discovery.
Params: - importer – the service importer
- configuration – the optional configuration
Returns: the current ServiceDiscovery
/**
* Registers a discovery service importer. Importers let you integrate other discovery technologies in this service
* discovery.
* @param importer the service importer
* @param configuration the optional configuration
* @return the current {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery}
*/
public io.vertx.reactivex.servicediscovery.ServiceDiscovery registerServiceImporter(io.vertx.reactivex.servicediscovery.spi.ServiceImporter importer, JsonObject configuration) {
return
registerServiceImporter(importer, configuration, ar -> { });
}
Registers a discovery service importer. Importers let you integrate other discovery technologies in this service
discovery.
Params: - importer – the service importer
- configuration – the optional configuration
Returns: the current ServiceDiscovery
/**
* Registers a discovery service importer. Importers let you integrate other discovery technologies in this service
* discovery.
* @param importer the service importer
* @param configuration the optional configuration
* @return the current {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery}
*/
public io.reactivex.Completable rxRegisterServiceImporter(io.vertx.reactivex.servicediscovery.spi.ServiceImporter importer, JsonObject configuration) {
return AsyncResultCompletable.toCompletable($handler -> {
registerServiceImporter(importer, configuration, $handler);
});
}
Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service
discovery.
Params: - exporter – the service exporter
- configuration – the optional configuration
- completionHandler – handler notified when the exporter has been correctly initialized.
Returns: the current ServiceDiscovery
/**
* Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service
* discovery.
* @param exporter the service exporter
* @param configuration the optional configuration
* @param completionHandler handler notified when the exporter has been correctly initialized.
* @return the current {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery}
*/
public io.vertx.reactivex.servicediscovery.ServiceDiscovery registerServiceExporter(io.vertx.reactivex.servicediscovery.spi.ServiceExporter exporter, JsonObject configuration, Handler<AsyncResult<Void>> completionHandler) {
delegate.registerServiceExporter(exporter.getDelegate(), configuration, completionHandler);
return this;
}
Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service
discovery.
Params: - exporter – the service exporter
- configuration – the optional configuration
Returns: the current ServiceDiscovery
/**
* Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service
* discovery.
* @param exporter the service exporter
* @param configuration the optional configuration
* @return the current {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery}
*/
public io.vertx.reactivex.servicediscovery.ServiceDiscovery registerServiceExporter(io.vertx.reactivex.servicediscovery.spi.ServiceExporter exporter, JsonObject configuration) {
return
registerServiceExporter(exporter, configuration, ar -> { });
}
Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service
discovery.
Params: - exporter – the service exporter
- configuration – the optional configuration
Returns: the current ServiceDiscovery
/**
* Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service
* discovery.
* @param exporter the service exporter
* @param configuration the optional configuration
* @return the current {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery}
*/
public io.reactivex.Completable rxRegisterServiceExporter(io.vertx.reactivex.servicediscovery.spi.ServiceExporter exporter, JsonObject configuration) {
return AsyncResultCompletable.toCompletable($handler -> {
registerServiceExporter(exporter, configuration, $handler);
});
}
Closes the service discovery
/**
* Closes the service discovery
*/
public void close() {
delegate.close();
}
Publishes a record.
Params: - record – the 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.
/**
* Publishes a record.
* @param record the record
* @param 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.
*/
public void publish(io.vertx.servicediscovery.Record record, Handler<AsyncResult<io.vertx.servicediscovery.Record>> resultHandler) {
delegate.publish(record, resultHandler);
}
Publishes a record.
Params: - record – the record
/**
* Publishes a record.
* @param record the record
*/
public void publish(io.vertx.servicediscovery.Record record) {
publish(record, ar -> { });
}
Publishes a record.
Params: - record – the record
Returns:
/**
* Publishes a record.
* @param record the record
* @return
*/
public io.reactivex.Single<io.vertx.servicediscovery.Record> rxPublish(io.vertx.servicediscovery.Record record) {
return AsyncResultSingle.toSingle($handler -> {
publish(record, $handler);
});
}
Un-publishes a record.
Params: - id – the registration id
- resultHandler – handler called when the operation has completed (successfully or not).
/**
* Un-publishes a record.
* @param id the registration id
* @param resultHandler handler called when the operation has completed (successfully or not).
*/
public void unpublish(String id, Handler<AsyncResult<Void>> resultHandler) {
delegate.unpublish(id, resultHandler);
}
Un-publishes a record.
Params: - id – the registration id
/**
* Un-publishes a record.
* @param id the registration id
*/
public void unpublish(String id) {
unpublish(id, ar -> { });
}
Un-publishes a record.
Params: - id – the registration id
Returns:
/**
* Un-publishes a record.
* @param id the registration id
* @return
*/
public io.reactivex.Completable rxUnpublish(String id) {
return AsyncResultCompletable.toCompletable($handler -> {
unpublish(id, $handler);
});
}
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.
Params: - 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
).
/**
* Lookups for a single record.
* <p>
* 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.
* <p>
* Let's take some example:
* <pre>
* { "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"
* </pre>
* <p>
* If the filter is not set (<code>null</code> or empty), it accepts all records.
* <p>
* This method returns the first matching record.
* @param filter the filter.
* @param 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 (<code>null</code>).
*/
public void getRecord(JsonObject filter, Handler<AsyncResult<io.vertx.servicediscovery.Record>> resultHandler) {
delegate.getRecord(filter, resultHandler);
}
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.
Params: - filter – the filter.
/**
* Lookups for a single record.
* <p>
* 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.
* <p>
* Let's take some example:
* <pre>
* { "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"
* </pre>
* <p>
* If the filter is not set (<code>null</code> or empty), it accepts all records.
* <p>
* This method returns the first matching record.
* @param filter the filter.
*/
public void getRecord(JsonObject filter) {
getRecord(filter, ar -> { });
}
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.
Params: - filter – the filter.
Returns:
/**
* Lookups for a single record.
* <p>
* 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.
* <p>
* Let's take some example:
* <pre>
* { "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"
* </pre>
* <p>
* If the filter is not set (<code>null</code> or empty), it accepts all records.
* <p>
* This method returns the first matching record.
* @param filter the filter.
* @return
*/
public io.reactivex.Maybe<io.vertx.servicediscovery.Record> rxGetRecord(JsonObject filter) {
return AsyncResultMaybe.toMaybe($handler -> {
getRecord(filter, $handler);
});
}
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.
Params: - 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.
/**
* Lookups for a single record.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* This method only looks for records with a <code>UP</code> status.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param 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.
*/
public void getRecord(Function<io.vertx.servicediscovery.Record, Boolean> filter, Handler<AsyncResult<io.vertx.servicediscovery.Record>> resultHandler) {
delegate.getRecord(filter, 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.
This method only looks for records with a UP
status.
Params: - filter – the filter, must not be
null
. To return all records, use a function accepting all records
/**
* Lookups for a single record.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* This method only looks for records with a <code>UP</code> status.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
*/
public void getRecord(Function<io.vertx.servicediscovery.Record, Boolean> filter) {
getRecord(filter, ar -> { });
}
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.
Params: - filter – the filter, must not be
null
. To return all records, use a function accepting all records
Returns:
/**
* Lookups for a single record.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* This method only looks for records with a <code>UP</code> status.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @return
*/
public io.reactivex.Maybe<io.vertx.servicediscovery.Record> rxGetRecord(Function<io.vertx.servicediscovery.Record, Boolean> filter) {
return AsyncResultMaybe.toMaybe($handler -> {
getRecord(filter, $handler);
});
}
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 getRecord
, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Params: - 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.
/**
* Lookups for a single record.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method may accept records with a <code>OUT OF SERVICE</code>
* status, if the <code>includeOutOfService</code> parameter is set to <code>true</code>.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param includeOutOfService whether or not the filter accepts <code>OUT OF SERVICE</code> records
* @param 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.
*/
public void getRecord(Function<io.vertx.servicediscovery.Record, Boolean> filter, boolean includeOutOfService, Handler<AsyncResult<io.vertx.servicediscovery.Record>> resultHandler) {
delegate.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 getRecord
, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Params: - 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
/**
* Lookups for a single record.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method may accept records with a <code>OUT OF SERVICE</code>
* status, if the <code>includeOutOfService</code> parameter is set to <code>true</code>.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param includeOutOfService whether or not the filter accepts <code>OUT OF SERVICE</code> records
*/
public void getRecord(Function<io.vertx.servicediscovery.Record, Boolean> filter, boolean includeOutOfService) {
getRecord(filter, includeOutOfService, ar -> { });
}
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 getRecord
, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Params: - 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
Returns:
/**
* Lookups for a single record.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method may accept records with a <code>OUT OF SERVICE</code>
* status, if the <code>includeOutOfService</code> parameter is set to <code>true</code>.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param includeOutOfService whether or not the filter accepts <code>OUT OF SERVICE</code> records
* @return
*/
public io.reactivex.Maybe<io.vertx.servicediscovery.Record> rxGetRecord(Function<io.vertx.servicediscovery.Record, Boolean> filter, boolean includeOutOfService) {
return AsyncResultMaybe.toMaybe($handler -> {
getRecord(filter, includeOutOfService, $handler);
});
}
Lookups for a set of records. Unlike getRecord
, this method returns all matching records. Params: - filter – the filter - see
getRecord
- 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.
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* @param filter the filter - see {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}
* @param 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.
*/
public void getRecords(JsonObject filter, Handler<AsyncResult<List<io.vertx.servicediscovery.Record>>> resultHandler) {
delegate.getRecords(filter, resultHandler);
}
Lookups for a set of records. Unlike getRecord
, this method returns all matching records. Params: - filter – the filter - see
getRecord
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* @param filter the filter - see {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}
*/
public void getRecords(JsonObject filter) {
getRecords(filter, ar -> { });
}
Lookups for a set of records. Unlike getRecord
, this method returns all matching records. Params: - filter – the filter - see
getRecord
Returns:
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* @param filter the filter - see {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}
* @return
*/
public io.reactivex.Single<List<io.vertx.servicediscovery.Record>> rxGetRecords(JsonObject filter) {
return AsyncResultSingle.toSingle($handler -> {
getRecords(filter, $handler);
});
}
Lookups for a set of records. Unlike 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.
This method only looks for records with a UP
status.
Params: - 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.
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* This method only looks for records with a <code>UP</code> status.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param 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.
*/
public void getRecords(Function<io.vertx.servicediscovery.Record, Boolean> filter, Handler<AsyncResult<List<io.vertx.servicediscovery.Record>>> resultHandler) {
delegate.getRecords(filter, resultHandler);
}
Lookups for a set of records. Unlike 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.
This method only looks for records with a UP
status.
Params: - filter – the filter, must not be
null
. To return all records, use a function accepting all records
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* This method only looks for records with a <code>UP</code> status.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
*/
public void getRecords(Function<io.vertx.servicediscovery.Record, Boolean> filter) {
getRecords(filter, ar -> { });
}
Lookups for a set of records. Unlike 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.
This method only looks for records with a UP
status.
Params: - filter – the filter, must not be
null
. To return all records, use a function accepting all records
Returns:
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* This method only looks for records with a <code>UP</code> status.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @return
*/
public io.reactivex.Single<List<io.vertx.servicediscovery.Record>> rxGetRecords(Function<io.vertx.servicediscovery.Record, Boolean> filter) {
return AsyncResultSingle.toSingle($handler -> {
getRecords(filter, $handler);
});
}
Lookups for a set of records. Unlike 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 getRecords
, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Params: - 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.
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecords}, this method may accept records with a <code>OUT OF SERVICE</code>
* status, if the <code>includeOutOfService</code> parameter is set to <code>true</code>.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param includeOutOfService whether or not the filter accepts <code>OUT OF SERVICE</code> records
* @param 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.
*/
public void getRecords(Function<io.vertx.servicediscovery.Record, Boolean> filter, boolean includeOutOfService, Handler<AsyncResult<List<io.vertx.servicediscovery.Record>>> resultHandler) {
delegate.getRecords(filter, includeOutOfService, resultHandler);
}
Lookups for a set of records. Unlike 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 getRecords
, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Params: - 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
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecords}, this method may accept records with a <code>OUT OF SERVICE</code>
* status, if the <code>includeOutOfService</code> parameter is set to <code>true</code>.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param includeOutOfService whether or not the filter accepts <code>OUT OF SERVICE</code> records
*/
public void getRecords(Function<io.vertx.servicediscovery.Record, Boolean> filter, boolean includeOutOfService) {
getRecords(filter, includeOutOfService, ar -> { });
}
Lookups for a set of records. Unlike 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 getRecords
, this method may accept records with a OUT OF SERVICE
status, if the includeOutOfService
parameter is set to true
.
Params: - 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
Returns:
/**
* Lookups for a set of records. Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching
* records.
* <p>
* The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it
* as an <code>accept</code> method of a filter. This method return a record passing the filter.
* <p>
* Unlike {@link io.vertx.reactivex.servicediscovery.ServiceDiscovery#getRecords}, this method may accept records with a <code>OUT OF SERVICE</code>
* status, if the <code>includeOutOfService</code> parameter is set to <code>true</code>.
* @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records
* @param includeOutOfService whether or not the filter accepts <code>OUT OF SERVICE</code> records
* @return
*/
public io.reactivex.Single<List<io.vertx.servicediscovery.Record>> rxGetRecords(Function<io.vertx.servicediscovery.Record, Boolean> filter, boolean includeOutOfService) {
return AsyncResultSingle.toSingle($handler -> {
getRecords(filter, includeOutOfService, $handler);
});
}
Updates the given record. The record must has been published, and has it's registration id set.
Params: - record – the updated record
- resultHandler – handler called when the lookup has been completed.
/**
* Updates the given record. The record must has been published, and has it's registration id set.
* @param record the updated record
* @param resultHandler handler called when the lookup has been completed.
*/
public void update(io.vertx.servicediscovery.Record record, Handler<AsyncResult<io.vertx.servicediscovery.Record>> resultHandler) {
delegate.update(record, resultHandler);
}
Updates the given record. The record must has been published, and has it's registration id set.
Params: - record – the updated record
/**
* Updates the given record. The record must has been published, and has it's registration id set.
* @param record the updated record
*/
public void update(io.vertx.servicediscovery.Record record) {
update(record, ar -> { });
}
Updates the given record. The record must has been published, and has it's registration id set.
Params: - record – the updated record
Returns:
/**
* Updates the given record. The record must has been published, and has it's registration id set.
* @param record the updated record
* @return
*/
public io.reactivex.Single<io.vertx.servicediscovery.Record> rxUpdate(io.vertx.servicediscovery.Record record) {
return AsyncResultSingle.toSingle($handler -> {
update(record, $handler);
});
}
Returns: the set of service references retrieved by this service discovery.
/**
* @return the set of service references retrieved by this service discovery.
*/
public Set<io.vertx.reactivex.servicediscovery.ServiceReference> bindings() {
Set<io.vertx.reactivex.servicediscovery.ServiceReference> ret = delegate.bindings().stream().map(elt -> io.vertx.reactivex.servicediscovery.ServiceReference.newInstance((io.vertx.servicediscovery.ServiceReference)elt)).collect(Collectors.toSet());
return ret;
}
Returns: the discovery options. Modifying the returned object would not update the discovery service configuration. This object should be considered as read-only.
/**
* @return the discovery options. Modifying the returned object would not update the discovery service configuration. This object should be considered as read-only.
*/
public io.vertx.servicediscovery.ServiceDiscoveryOptions options() {
io.vertx.servicediscovery.ServiceDiscoveryOptions ret = delegate.options();
return ret;
}
Release the service object retrieved using get
methods from the service type interface.
It searches for the reference associated with the given object and release it.
Params: - discovery – the service discovery
- svcObject – the service object
/**
* Release the service object retrieved using <code>get</code> methods from the service type interface.
* It searches for the reference associated with the given object and release it.
* @param discovery the service discovery
* @param svcObject the service object
*/
public static void releaseServiceObject(io.vertx.reactivex.servicediscovery.ServiceDiscovery discovery, java.lang.Object svcObject) {
io.vertx.servicediscovery.ServiceDiscovery.releaseServiceObject(discovery.getDelegate(), svcObject);
}
public static ServiceDiscovery newInstance(io.vertx.servicediscovery.ServiceDiscovery arg) {
return arg != null ? new ServiceDiscovery(arg) : null;
}
}