Class StreamRequest


  • public class StreamRequest
    extends java.lang.Object
    Defines the request body for interacting with the Fauna /stream endpoint.

    The StreamRequest class constructs a JSON request body that includes an EventSource and StreamOptions to configure the request parameters.

    • Constructor Summary

      Constructors 
      Constructor Description
      StreamRequest​(EventSource eventSource, StreamOptions streamOptions)
      Constructs a StreamRequest with the specified event source and options.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String serialize()
      Serializes this StreamRequest to a JSON string for the Fauna /stream endpoint.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StreamRequest

        public StreamRequest​(EventSource eventSource,
                             StreamOptions streamOptions)
        Constructs a StreamRequest with the specified event source and options.
        Parameters:
        eventSource - The EventSource providing the event source token.
        streamOptions - The StreamOptions specifying additional request options.
        Throws:
        java.lang.IllegalArgumentException - if eventSource or streamOptions is null.
    • Method Detail

      • serialize

        public java.lang.String serialize()
                                   throws java.io.IOException
        Serializes this StreamRequest to a JSON string for the Fauna /stream endpoint.

        The JSON includes fields based on the EventSource and StreamOptions configurations. Either the cursor or start timestamp is included, with cursor taking precedence.

        Returns:
        A JSON-formatted String representing this stream request.
        Throws:
        java.io.IOException - if an error occurs during serialization.