Package com.zb.mom.ww.mxgateway.client
Class MxEventStream
java.lang.Object
com.zb.mom.ww.mxgateway.client.MxEventStream
- All Implemented Interfaces:
AutoCloseable,Iterator<MxaccessGateway.MxEvent>
public final class MxEventStream
extends Object
implements Iterator<MxaccessGateway.MxEvent>, AutoCloseable
Iterator-style adaptor over the gateway
StreamEvents server-streaming
RPC.
Events arrive on a background gRPC thread and are buffered in a bounded
blocking queue; the iterator drains them on the calling thread. Closing the
stream cancels the underlying gRPC call. If the queue overflows the call is
cancelled and a follow-up call to next() throws
MxGatewayException.
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<MxaccessGateway.MxEvent>
-
next
- Specified by:
nextin interfaceIterator<MxaccessGateway.MxEvent>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-