reply method
Sends a reply to this query with a string value.
The keyExpr should match the queryable's key expression.
Optionally specify an encoding for the payload, a binary attachment
carried alongside the reply sample, and a timestamp stamped onto the
reply.
isExpress disables batching for this reply; omitting it — or passing
null — means canon decides, which is false.
isExpress is the ONLY quality-of-service option on the reply path, and
that is deliberate. canon marks a reply's congestion control and priority
deprecated and ignored ("Reply congestion control is not supported
anymore"), so this binding does not expose them: a reply inherits the
QUERY's congestion control and priority, and nothing set here could
change that. Set them on the get or Querier instead.
Throws StateError if the query has been disposed. Throws ZenohException if the reply fails.
Implementation
void reply(
Object keyExpr,
String value, {
Encoding? encoding,
ZBytes? attachment,
Timestamp? timestamp,
bool? isExpress,
}) {
// ALLOCATE-LAST. replyBytes' own pre-move guards throw BEFORE consuming
// the payload -- a disposed query (StateError) and a rejected key
// expression (ArgumentError or ZenohException) -- and this method builds
// the ZBytes for them. Nothing else holds a reference to it, so the guard
// has to run before the ZBytes exists. The query guard does that here;
// the key expression is validated once, downstream, by replyBytes' union
// dispatch -- which is still before the payload is moved, because the
// dispatch encloses the FFI call.
//
// This method no longer constructs a throwaway KeyExpr of its own. One
// reply() used to validate the same string three times: here, in
// replyBytes, and again in the shim.
_ensureNotDisposed();
final zbytes = ZBytes.fromString(value);
replyBytes(
keyExpr,
zbytes,
encoding: encoding,
attachment: attachment,
timestamp: timestamp,
isExpress: isExpress,
);
}