PgChannel

A channel to Postgres that tracks the subscription to a given Postgres channel using the <code>LISTEN/UNLISTEN</code> commands.

When paused the channel discards the messages.

package

Default

Methods

__construct

__construct() 

Set an handler to be called when no more notifications will be received.

endHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

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

exceptionHandler

exceptionHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Fetch the specified <code>amount</code> of elements. If the <code>ReadStream</code> has been paused, reading will recommence with the specified <code>amount</code> of items, otherwise the specified <code>amount</code> will be added to the current stream demand.

fetch( $arg0) : $this

Arguments

$arg0

integer

Response

$this

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

Set or unset an handler to be called when a the channel is notified by Postgres.

handler( $arg0) : $this

  • 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

Arguments

$arg0

callable

Response

$this

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

Pause the channel, all notifications are discarded.

pause() : $this

Response

$this

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

Pause this stream and return a to transfer the elements of this stream to a destination .

pipe() : \io\vertx\jphp\pgclient\pubsub\Pipe<String>

The stream will be resumed when the pipe will be wired to a WriteStream.

Response

\io\vertx\jphp\pgclient\pubsub\Pipe

a pipe

Like @see \io\vertx\jphp\core\streams\ReadStream::pipeTo but with no completion handler.

pipeTo( $arg0,  $arg1 = null) : void

param $dst [WriteStream] pipeTo($dst)

Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result. param $dst [WriteStream] the destination write stream param $handler [callable] pipeTo($dst, $handler)

Arguments

$arg0

WriteStream

$arg1

callable

Resume the channel.

resume() : $this

Response

$this

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

Set an handler called when the the channel get subscribed.

subscribeHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

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