Class LiveTailHandle

java.lang.Object
codes.grow.packages.cloudwatchlogs.LiveTailHandle
All Implemented Interfaces:
TailHandle, AutoCloseable

public final class LiveTailHandle extends Object implements TailHandle
Handle of a live-tail session (startLiveTail). On AWS a session streams new events for up to 3 hours; the Moto emulator replays matching existing events once and ends the session.
  • Method Details

    • sessionId

      public String sessionId()
      Returns the session id from the sessionStart frame.
      Returns:
      the id (empty when the stream ended before the session started)
    • done

      public CompletableFuture<Void> done()
      Returns a future that completes when the session ends (service closed it, error, or close()). It never completes exceptionally; see error().
      Returns:
      the future
    • await

      public boolean await(Duration timeout)
      Waits until the session ended or the timeout passed.
      Parameters:
      timeout - how long to wait
      Returns:
      true when the session ended
    • error

      Returns the error that ended the session, if any (also passed to onError).
      Returns:
      the error, or empty
    • isClosed

      public boolean isClosed()
      Returns whether the session has ended.
      Returns:
      true once ended
    • stop

      public void stop()
      Stops the session (same as close()). Idempotent.
      Specified by:
      stop in interface TailHandle
    • close

      public void close()
      Stops the session and releases the stream. Idempotent.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface TailHandle
    • toString

      public String toString()
      Overrides:
      toString in class Object