Interface PgChannel

  • All Superinterfaces:
    ReadStream<String>, StreamBase

    public interface PgChannel
    extends ReadStream<String>
    A channel to Postgres that tracks the subscription to a given Postgres channel using the LISTEN/UNLISTEN commands.

    When paused the channel discards the messages.

    • Method Detail

      • subscribeHandler

        PgChannel subscribeHandler​(Handler<Void> handler)
        Set an handler called when the the channel get subscribed.
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • handler

        PgChannel handler​(Handler<String> handler)
        Set or unset an handler to be called when a the channel is notified by Postgres.

        • when the handler is set, the subscriber sends a LISTEN command if needed
        • when the handler is unset, the subscriber sends a UNLISTEN command if needed
        Specified by:
        handler in interface ReadStream<String>
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • pause

        PgChannel pause()
        Pause the channel, all notifications are discarded.
        Specified by:
        pause in interface ReadStream<String>
        Returns:
        a reference to this, so the API can be used fluently
      • resume

        PgChannel resume()
        Resume the channel.
        Specified by:
        resume in interface ReadStream<String>
        Returns:
        a reference to this, so the API can be used fluently
      • endHandler

        PgChannel endHandler​(Handler<Void> endHandler)
        Set an handler to be called when no more notifications will be received.
        Specified by:
        endHandler in interface ReadStream<String>
        Parameters:
        endHandler - the handler
        Returns:
        a reference to this, so the API can be used fluently