io.vertx.pgclient.pubsub

## 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 Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `PgChannel` | `endHandler(Handler<Void> endHandler)` Set an handler to be called when no more notifications will be received.
    `PgChannel` | `exceptionHandler(Handler<Throwable> handler)` Set an exception handler on the read stream.
    `PgChannel` | `handler(Handler<String> handler)` Set or unset an handler to be called when a the channel is notified by Postgres.
    `PgChannel` | `pause()` Pause the channel, all notifications are discarded.
    `PgChannel` | `resume()` Resume the channel.
    `PgChannel` | `subscribeHandler(Handler<Void> handler)` Set an handler called when the the channel get subscribed.

    - ### Methods inherited from interface io.vertx.core.streams.ReadStream

      `fetch, pipe, pipeTo, pipeTo`

- - ### 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

    - #### exceptionHandler

          PgChannel exceptionHandler(Handler<Throwable> handler)

      Description copied from interface: `ReadStream`
      Set an exception handler on the read stream.
      Specified by:
        `exceptionHandler` in interface `ReadStream<String>`
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Parameters:
        `handler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

Copyright © 2023 Eclipse. All rights reserved.