Package io.zenoh.query
Class Querier
-
- All Implemented Interfaces:
-
io.zenoh.session.SessionDeclaration
,java.lang.AutoCloseable
public final class Querier implements SessionDeclaration, AutoCloseable
A querier that allows to send queries to a Queryable.
Queriers are automatically undeclared when dropped.
Example:
try (Session session = Zenoh.open(config)) { QuerierOptions options = new QuerierOptions(); options.setTarget(QueryTarget.BEST_MATCHING); Querier querier = session.declareQuerier(selector.getKeyExpr(), options); //... Querier.GetOptions options = new Querier.GetOptions(); options.setPayload(ZBytes.from("Example payload")); querier.get(reply -> {...}, options); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
Querier.GetOptions
Get options for the Querier.
-
Method Summary
Modifier and Type Method Description final KeyExpr
getKeyExpr()
final QoS
getQos()
final BlockingQueue<Optional<Reply>>
get(Querier.GetOptions options)
Perform a get operation to the keyExpr from the Querier and pipe them into a blocking queue. final Unit
get(Callback<Reply> callback, Querier.GetOptions options)
Perform a get operation to the keyExpr from the Querier and handle the incoming replies with the callback provided. final <R extends Any> R
get(Handler<Reply, R> handler, Querier.GetOptions options)
Perform a get operation to the keyExpr from the Querier and handle the incoming replies with the handler provided. final CongestionControl
congestionControl()
Get the QoS.congestionControl of the querier. final Priority
priority()
Get the QoS.priority of the querier. Unit
undeclare()
Undeclares the querier. Unit
close()
Closes the querier. -
-
Method Detail
-
getKeyExpr
final KeyExpr getKeyExpr()
-
get
final BlockingQueue<Optional<Reply>> get(Querier.GetOptions options)
Perform a get operation to the keyExpr from the Querier and pipe them into a blocking queue.
-
get
final Unit get(Callback<Reply> callback, Querier.GetOptions options)
Perform a get operation to the keyExpr from the Querier and handle the incoming replies with the callback provided.
- Parameters:
callback
- Callback to handle the incoming replies.options
- GetOptions to configure the get operation.
-
get
final <R extends Any> R get(Handler<Reply, R> handler, Querier.GetOptions options)
Perform a get operation to the keyExpr from the Querier and handle the incoming replies with the handler provided.
- Parameters:
handler
- Handler to handle the receiving replies to the query.options
- GetOptions to configure the get operation.
-
congestionControl
final CongestionControl congestionControl()
Get the QoS.congestionControl of the querier.
-
priority
final Priority priority()
Get the QoS.priority of the querier.
-
undeclare
Unit undeclare()
Undeclares the querier. After calling this function, the querier won't be valid anymore and get operations performed on it will fail.
-
-
-
-