ServiceReference

Once a consumer has chosen a service, it builds a @see \io\vertx\jphp\servicediscovery\ServiceReference managing the binding with the chosen service provider.

The reference lets the consumer: * access the service (via a proxy or a client) with the @see \io\vertx\jphp\servicediscovery\ServiceReference::get method * release the reference - so the binding between the consumer and the provider is removed

package

Default

Methods

Gets the service object if already retrieved. It won't try to acquire the service object if not retrieved yet.

cached() : mixed

Response

mixed

the object, {@code null} if not yet retrieved

Gets the service object if already retrieved. It won't try to acquire the service object if not retrieved yet.

cachedAs( $arg0) : mixed

Unlike @see \io\vertx\jphp\servicediscovery\ServiceReference::cached, this method return the warpped object to the desired (given) type.

Arguments

$arg0

string

Response

mixed

the object, {@code null} if not yet retrieved

Gets the object to access the service. It can be a proxy, a client or whatever object. The type depends on the service type and the server itself. This method returns the Java version and primary facet of the object, use

get() : mixed
see \io\vertx\jphp\servicediscovery\ServiceReference::getAs

to retrieve the polyglot instance of the object or another facet..

Response

mixed

the object to access the service

Gets the object to access the service. It can be a proxy, a client or whatever object. The type depends on the service type and the server itself. This method wraps the service object into the desired type.

getAs( $arg0) : mixed

Arguments

$arg0

string

Response

mixed

the object to access the service wrapped to the given type

Checks whether or not the service reference has the given service object.

isHolding( $arg0) : boolean

Arguments

$arg0

mixed

Response

boolean

{@code true} if the service reference service object is equal to the given object, {@code false} otherwise.

record

record() : \io\vertx\jphp\servicediscovery\Record

Response

\io\vertx\jphp\servicediscovery\Record

the service record.

Releases the reference. Once released, the consumer must not use the reference anymore.

release() : void

This method must be idempotent and defensive, as multiple call may happen.