io.vertx.rxjava.pgclient.pubsub

## Class PgSubscriber

- java.lang.Object
- - io.vertx.rxjava.pgclient.pubsub.PgSubscriber

-     public class PgSubscriber
      extends Object

  A class for managing subscriptions using `LISTEN/UNLISTEN` to Postgres channels.

  The subscriber manages a single connection to Postgres.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<PgSubscriber>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PgSubscriber(Object delegate)`
    `PgSubscriber(PgSubscriber delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PgConnection` | `actualConnection()`
    `PgChannel` | `channel(String name)` Return a channel for the given `name`.
    `void` | `close()` Close the subscriber, the retry policy will not be invoked.
    `void` | `close(Handler<AsyncResult<Void>> handler)` Close the subscriber, the retry policy will not be invoked.
    `boolean` | `closed()`
    `PgSubscriber` | `closeHandler(Handler<Void> handler)` Set an handler called when the subscriber is closed.
    `PgSubscriber` | `connect()` Connect the subscriber to Postgres.
    `PgSubscriber` | `connect(Handler<AsyncResult<Void>> handler)` Connect the subscriber to Postgres.
    `boolean` | `equals(Object o)`
    `PgSubscriber` | `getDelegate()`
    `int` | `hashCode()`
    `static PgSubscriber` | `newInstance(PgSubscriber arg)`
    `PgSubscriber` | `reconnectPolicy(java.util.function.Function<Integer,Long> policy)` Set the reconnect policy that is executed when the subscriber is disconnected.
    `Single<Void>` | `rxClose()` Close the subscriber, the retry policy will not be invoked.
    `Single<Void>` | `rxConnect()` Connect the subscriber to Postgres.
    `static PgSubscriber` | `subscriber(Vertx vertx, PgConnectOptions options)` Create a subscriber.
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<PgSubscriber> __TYPE_ARG

  - ### Constructor Detail

    - #### PgSubscriber

          public PgSubscriber(PgSubscriber delegate)

    - #### PgSubscriber

          public PgSubscriber(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public PgSubscriber getDelegate()

    - #### subscriber

          public static PgSubscriber subscriber(Vertx vertx,
                                                PgConnectOptions options)

      Create a subscriber.
      Parameters:
        `vertx` - the vertx instance
        `options` - the connect options
      Returns:
        the subscriber

    - #### channel

          public PgChannel channel(String name)

      Return a channel for the given `name`.
      Parameters:
        `name` - the channel name

        This will be the name of the channel exactly as held by Postgres for sending notifications. Internally this name will be truncated to the Postgres identifier maxiumum length of `(NAMEDATALEN = 64) - 1 == 63` characters, and prepared as a quoted identifier without unicode escape sequence support for use in `LISTEN/UNLISTEN` commands. Examples of channel names and corresponding `NOTIFY` commands:
        - when `name == "the_channel"`: `NOTIFY the_channel, 'msg'`, `NOTIFY The_Channel, 'msg'`, or `NOTIFY "the_channel", 'msg'` succeed in delivering a message to the created channel
        - when `name == "The_Channel"`: `NOTIFY "The_Channel", 'msg'`, succeeds in delivering a message to the created channel
      Returns:
        the channel

    - #### connect

          public PgSubscriber connect(Handler<AsyncResult<Void>> handler)

      Connect the subscriber to Postgres.
      Parameters:
        `handler` - the handler notified of the connection success or failure
      Returns:
        a reference to this, so the API can be used fluently

    - #### connect

          public PgSubscriber connect()

      Connect the subscriber to Postgres.
      Returns:
        a reference to this, so the API can be used fluently

    - #### rxConnect

          public Single<Void> rxConnect()

      Connect the subscriber to Postgres.
      Returns:
        a reference to this, so the API can be used fluently

    - #### reconnectPolicy

          public PgSubscriber reconnectPolicy(java.util.function.Function<Integer,Long> policy)

      Set the reconnect policy that is executed when the subscriber is disconnected.

      When the subscriber is disconnected, the `policy` function is called with the actual number of retries and returns an `amountOfTime` value:
      - when `amountOfTime < 0`: the subscriber is closed and there is no retry
      - when `amountOfTime == 0`: the subscriber retries to connect immediately
      - when `amountOfTime > 0`: the subscriber retries after `amountOfTime` milliseconds

      The default policy does not perform any retries.
      Parameters:
        `policy` - the policy to set
      Returns:
        a reference to this, so the API can be used fluently

    - #### closeHandler

          public PgSubscriber closeHandler(Handler<Void> handler)

      Set an handler called when the subscriber is closed.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### actualConnection

          public PgConnection actualConnection()

      Returns:
        the actual connection to Postgres, it might be `null`

    - #### closed

          public boolean closed()

      Returns:
        whether the subscriber is closed

    - #### close

          public void close(Handler<AsyncResult<Void>> handler)

      Close the subscriber, the retry policy will not be invoked.
      Parameters:
        `handler` -

    - #### close

          public void close()

      Close the subscriber, the retry policy will not be invoked.

    - #### rxClose

          public Single<Void> rxClose()

      Close the subscriber, the retry policy will not be invoked.
      Returns:

    - #### newInstance

          public static PgSubscriber newInstance(PgSubscriber arg)

Copyright © 2024 Eclipse. All rights reserved.