Package io.zenoh.pubsub
Class HandlerSubscriber
-
- All Implemented Interfaces:
-
io.zenoh.session.SessionDeclaration
,java.lang.AutoCloseable
public final class HandlerSubscriber<R extends Object> extends Subscriber
Subscriber using a io.zenoh.handlers.Handler for handling incoming samples.
Example using the default handler:
try (Session session = Zenoh.open(config)) { try (HandlerSubscriber<BlockingQueue<Optional<Sample>>> subscriber = session.declareSubscriber(keyExpr)) { BlockingQueue<Optional<Sample>> receiver = subscriber.getReceiver(); assert receiver != null; while (true) { Optional<Sample> wrapper = receiver.take(); if (wrapper.isEmpty()) { break; } System.out.println(wrapper.get()); } } }
-
-
Method Summary
Modifier and Type Method Description final R
getReceiver()
-
-
Method Detail
-
getReceiver
final R getReceiver()
-
-
-
-