Publisher
A Zenoh Publisher.
A publisher is automatically dropped when using it with the 'try-with-resources' statement (i.e. 'use' in Kotlin). The session from which it was declared will also keep a reference to it and undeclare it once the session is closed.
In order to declare a publisher, Session.declarePublisher must be called, which returns a Publisher.Builder from which we can specify the Priority, and the CongestionControl.
Example:
try (Session session = Session.open()) {
try (KeyExpr keyExpr = KeyExpr.tryFrom("demo/java/greeting")) {
System.out.println("Declaring publisher on '" + keyExpr + "'...");
try (Publisher publisher = session.declarePublisher(keyExpr).res()) {
int i = 0;
while (true) {
publisher.put("Hello for the " + i + "th time!").res();
Thread.sleep(1000);
i++;
}
}
}
} catch (ZenohException | InterruptedException e) {
System.out.println("Error: " + e);
}
Content copied to clipboard
The publisher configuration parameters can be later changed using the setter functions.
Types
Properties
Functions
Link copied to clipboard
Performs a DELETE operation on the specified keyExpr
Link copied to clipboard
Get congestion control policy.
Link copied to clipboard
Get priority policy.