Class QueryResultStreamAdapter

java.lang.Object
org.axonframework.axonserver.connector.event.axon.QueryResultStreamAdapter
All Implemented Interfaces:
AutoCloseable, Iterator<QueryResult>, QueryResultStream

public class QueryResultStreamAdapter extends Object implements QueryResultStream
Adapter for the QueryResultStream, wrapping a ResultStream of EventQueryResultEntry. Defers calls to the given resultStream, adapting them to a QueryResult.
Since:
4.5.2
Author:
Allard Buijze
  • Constructor Details

    • QueryResultStreamAdapter

      public QueryResultStreamAdapter(io.axoniq.axonserver.connector.ResultStream<io.axoniq.axonserver.connector.event.EventQueryResultEntry> resultStream)
      Construct a QueryResultStreamAdapter deferring calls to the given resultStream.
      Parameters:
      resultStream - the stream of EventQueryResultEntry to adapt to QueryResult instances
  • Method Details

    • hasNext

      public boolean hasNext(int timeout, TimeUnit unit)
      Description copied from interface: QueryResultStream
      Validates whether there is a following entry in this stream to consume. Uses the given timeout with the given unit to wait to respond
      Specified by:
      hasNext in interface QueryResultStream
      Returns:
      true if there is another entry, false if there isn't for at the given duration
    • next

      public QueryResult next()
      Description copied from interface: QueryResultStream
      Returns the following QueryResult from this stream. Might return null if nothing is present
      Specified by:
      next in interface Iterator<QueryResult>
      Specified by:
      next in interface QueryResultStream
      Returns:
      the following QueryResult from this stream
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception