com.streambase.sb.client

## Class DequeueResult

- java.lang.Object
- - com.streambase.sb.client.DequeueResult

- All Implemented Interfaces:
    Iterable<Tuple>
  Direct Known Subclasses:
    SimpleDequeueResult

      public abstract class DequeueResult
      extends Object
      implements Iterable<Tuple>

  Encapsulates the data returned from a dequeue() operation. Contains references to the originating stream, and a list of tuples.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `DequeueResult.Interceptor` A callback interface that can be implemented by an object that is associated with a StreamBaseClient and which gets used in the course of dequeuing tuples.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CLOSED` Status code indicating that the connection was closed
    `static int` | `GOOD` Status code indicating a normal dequeue
    `protected Constants.LeadershipStatus` | `leadershipStatus`
    `protected StreamProperties` | `props`
    `protected Throwable` | `throwable`
    `static int` | `TIMEOUT` Status code indicating a timeout during dequeue

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `checkStatus()` Check and return the status of this DequeueResult.
    `Constants.LeadershipStatus` | `getLeadershipStatus()` Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
    `Schema` | `getSchema()` Returns the schema for the tuples dequeued, may return null
    `StreamBaseURI` | `getServerURI()` return the server that produced this DequeueResult.
    `int` | `getStatus()` Return the status of this DequeueResult.
    `String` | `getStreamName()` Returns the name of the stream on which tuples were dequeued.
    `StreamProperties` | `getStreamProperties()` Return the StreamProperties for this DequeueResult.
    `abstract int` | `getTupleCount()` Returns the number of tuples dequeued.
    `abstract Iterator<Tuple>` | `iterator()` Returns an iterator of all tuples.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Field Detail

    - #### GOOD

          public static final int GOOD

      Status code indicating a normal dequeue
      See Also:
        Constant Field Values

    - #### TIMEOUT

          public static final int TIMEOUT

      Status code indicating a timeout during dequeue
      See Also:
        Constant Field Values

    - #### CLOSED

          public static final int CLOSED

      Status code indicating that the connection was closed
      See Also:
        Constant Field Values

    - #### props

          protected final StreamProperties props

    - #### throwable

          protected final Throwable throwable

    - #### leadershipStatus

          protected final Constants.LeadershipStatus leadershipStatus

  - ### Method Detail

    - #### getStreamName

          public String getStreamName()

      Returns the name of the stream on which tuples were dequeued. May return null.
      Returns:
        the unqualified name of the stream, may return null

    - #### getSchema

          public Schema getSchema()

      Returns the schema for the tuples dequeued, may return null
      Returns:
        the schema for the tuples dequeued, may return null
      Since:
        5.0

    - #### getStreamProperties

          public StreamProperties getStreamProperties()

      Return the StreamProperties for this DequeueResult. May return null
      Returns:
        StreamProperties, may return null

    - #### getLeadershipStatus

          @Deprecated
          public Constants.LeadershipStatus getLeadershipStatus()

      Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
      Return the leadership status of the server that produced this dequeue result.

      This method is no longer supported since the StreamBase 10 platform release. Please consult the documentation.

      Returns:
        the leadership status of the server that produced this dequeue result.
      Since:
        5.1

    - #### getServerURI

          public StreamBaseURI getServerURI()

      return the server that produced this DequeueResult. May return null.
      Returns:
        the server that produced this DequeueResult. May return null.
      Since:
        5.1

    - #### getTupleCount

          public abstract int getTupleCount()

      Returns the number of tuples dequeued.
      Returns:
        number of tuples

    - #### iterator

          public abstract Iterator<Tuple> iterator()

      Returns an iterator of all tuples.
      Specified by:
        `iterator` in interface `Iterable<Tuple>`

    - #### getStatus

          public int getStatus()

      Return the status of this DequeueResult.
      - `DequeueResult.GOOD` if the DequeueResult contains tuples.
      - `DequeueResult.TIMEOUT` if the DequeueResult contains no tuples and the number of milliseconds specified in the dequeue(timeoutMS) method has expired.
      - `DequeueResult.CLOSED` if the connection was closed
      Returns:
        a status code as described
      See Also:
        `if need exceptions collected by this DequeueResult`

    - #### checkStatus

          public int checkStatus()
                          throws StreamBaseException

      Check and return the status of this DequeueResult. Similar to `DequeueResult.getStatus()` but will throw any exceptions that this DequeueResult has collected.
      Returns:
        a status code like `DequeueResult.getStatus()`
      Throws:
        `StreamBaseException` - if this DequeueResult has collected any exceptions
      Since:
        7.0
      See Also:
        `DequeueResult.getStatus()`

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.