public class LogEntryServerStream extends Object implements Iterable<LogEntry>
Iterable
interface over LogEntry
. It wraps around BidiStream
bi-directional gRPC stream to support iterating through ingested responses. The class
uses LogEntryIterator
to iterate through the processed responses. The stream should be
explicitly canceled by calling cancel()
method. The class does not
provide recovery or resuming functionality over the stream.
To iterate run:
LogEntryServerStream stream;
// code to initialize stream
for (LogEntry log : stream) {
// do something with logs
}
stream.cancel();
The iteration can be blocked on waiting for another response sent in the stream.
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cleanly cancels a partially consumed stream.
|
List<LogEntry> |
convert(TailLogEntriesResponse resp) |
com.google.api.gax.rpc.BidiStream<TailLogEntriesRequest,TailLogEntriesResponse> |
getInternalStream() |
boolean |
isReceiveReady()
Returns true if the next call to the iterator's hasNext() or next() is guaranteed to be
nonblocking.
|
Iterator<LogEntry> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public com.google.api.gax.rpc.BidiStream<TailLogEntriesRequest,TailLogEntriesResponse> getInternalStream()
public List<LogEntry> convert(TailLogEntriesResponse resp)
public boolean isReceiveReady()
public void cancel()
Copyright © 2023 Google LLC. All rights reserved.