PgSubscriber

A class for managing subscriptions using <code>LISTEN/UNLISTEN</code> to Postgres channels.

The subscriber manages a single connection to Postgres.

package

Default

Methods

__construct

__construct() 

actualConnection

actualConnection() : \io\vertx\jphp\pgclient\PgConnection

Response

\io\vertx\jphp\pgclient\PgConnection

the actual connection to Postgres, it might be {@code null}

Return a channel for the given <code>name</code>.

channel( $arg0) : \io\vertx\jphp\pgclient\pubsub\PgChannel

Arguments

$arg0

string

Response

\io\vertx\jphp\pgclient\pubsub\PgChannel

the channel

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

close() : void

closed

closed() : boolean

Response

boolean

whether the subscriber is closed

Set an handler called when the subscriber is closed.

closeHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Connect the subscriber to Postgres.

connect( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

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

reconnectPolicy( $arg0) : $this

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.

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Create a subscriber.

subscriber( $arg0,  $arg1) : \io\vertx\jphp\pgclient\pubsub\PgSubscriber
static

Arguments

$arg0

Vertx

$arg1

PgConnectOptions | array

Response

\io\vertx\jphp\pgclient\pubsub\PgSubscriber

the subscriber