Class Liveliness
-
- All Implemented Interfaces:
public final class Liveliness
A structure with functions to declare a LivelinessToken, query existing LivelinessTokens and subscribe to liveliness changes.
A LivelinessToken is a token which liveliness is tied to the Zenoh Session and can be monitored by remote applications.
The Liveliness instance can be obtained with the Session.liveliness function of the Session instance.
-
-
Method Summary
Modifier and Type Method Description final LivelinessToken
declareToken(KeyExpr keyExpr)
Create a LivelinessToken for the given key expression. final BlockingQueue<Optional<Reply>>
get(KeyExpr keyExpr, Duration timeout)
Query the liveliness tokens with matching key expressions. final Unit
get(KeyExpr keyExpr, Callback<Reply> callback, Duration timeout)
Query the liveliness tokens with matching key expressions. final <R extends Any> R
get(KeyExpr keyExpr, Handler<Reply, R> handler, Duration timeout)
Query the liveliness tokens with matching key expressions. final HandlerSubscriber<BlockingQueue<Optional<Sample>>>
declareSubscriber(KeyExpr keyExpr, LivelinessSubscriberOptions options)
Create a Subscriber for liveliness changes matching the given key expression. final CallbackSubscriber
declareSubscriber(KeyExpr keyExpr, Callback<Sample> callback, LivelinessSubscriberOptions options)
Create a Subscriber for liveliness changes matching the given key expression. final <R extends Any> HandlerSubscriber<R>
declareSubscriber(KeyExpr keyExpr, Handler<Sample, R> handler, LivelinessSubscriberOptions options)
Create a Subscriber for liveliness changes matching the given key expression. -
-
Method Detail
-
declareToken
final LivelinessToken declareToken(KeyExpr keyExpr)
Create a LivelinessToken for the given key expression.
-
get
final BlockingQueue<Optional<Reply>> get(KeyExpr keyExpr, Duration timeout)
Query the liveliness tokens with matching key expressions.
- Parameters:
keyExpr
- The KeyExpr for the query.timeout
- Optional timeout of the query, defaults to 10 secs.
-
get
final Unit get(KeyExpr keyExpr, Callback<Reply> callback, Duration timeout)
Query the liveliness tokens with matching key expressions.
-
get
final <R extends Any> R get(KeyExpr keyExpr, Handler<Reply, R> handler, Duration timeout)
Query the liveliness tokens with matching key expressions.
-
declareSubscriber
final HandlerSubscriber<BlockingQueue<Optional<Sample>>> declareSubscriber(KeyExpr keyExpr, LivelinessSubscriberOptions options)
Create a Subscriber for liveliness changes matching the given key expression.
- Parameters:
keyExpr
- The KeyExpr the subscriber will be listening to.options
- Optional LivelinessSubscriberOptions parameter for subscriber configuration.
-
declareSubscriber
final CallbackSubscriber declareSubscriber(KeyExpr keyExpr, Callback<Sample> callback, LivelinessSubscriberOptions options)
Create a Subscriber for liveliness changes matching the given key expression.
- Parameters:
keyExpr
- The KeyExpr the subscriber will be listening to.callback
- The Callback to be run when a liveliness change is received.options
- Optional LivelinessSubscriberOptions parameter for subscriber configuration.
-
declareSubscriber
final <R extends Any> HandlerSubscriber<R> declareSubscriber(KeyExpr keyExpr, Handler<Sample, R> handler, LivelinessSubscriberOptions options)
Create a Subscriber for liveliness changes matching the given key expression.
- Parameters:
keyExpr
- The KeyExpr the subscriber will be listening to.handler
- Handler to handle liveliness changes events.options
- Optional LivelinessSubscriberOptions parameter for subscriber configuration.
-
-
-
-