Publisher class

A zenoh publisher for efficiently publishing multiple messages on a single key expression.

Wraps z_owned_publisher_t. Call close when done to undeclare the publisher and release native resources.

This object holds a native handle, so it cannot cross an isolate boundary: a copy would share this one's native address while carrying its own fresh disposal flag, and the second release would be a use-after-free. Sending it throws ArgumentError naming the class.

It carries a NativeFinalizer safety net: if it is dropped without an explicit release, its native resources are reclaimed when the object is collected. ⛔ The net is not a substitute for releasing it explicitly — a finalizer runs at an unpredictable time, or not at all if the program exits first.

Implemented types

Constructors

Publisher.declare(Pointer<Void> loanedSession, Pointer<Void> loanedKe, {Encoding? encoding, CongestionControl? congestionControl, Priority? priority, bool? isExpress, Locality? allowedDestination, bool enableMatchingListener = false})
Creates a publisher on the given session and key expression.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
keyExpr String
The key expression this publisher is declared on.
no setter
matchingStatus Stream<bool>?
A stream of matching status changes, or null if the matching listener was not enabled when the publisher was declared. ⚠️ Unbounded, like every push stream here — but this is an edge-signal channel, not a data channel: it carries transitions, not traffic, so there is deliberately no bounded form of it.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
Undeclares the publisher and releases native resources.
deleteResource({Timestamp? timestamp}) → void
Sends a DELETE through this publisher.
hasMatchingSubscribers() bool
Returns whether any subscribers currently match this publisher's key expression.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(String value, {Encoding? encoding, ZBytes? attachment, Timestamp? timestamp}) → void
Publishes a string value through this publisher.
putBytes(ZBytes payload, {Encoding? encoding, ZBytes? attachment, Timestamp? timestamp}) → void
Publishes ZBytes payload through this publisher.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited