Class: PgChannel

vertx-pg-client-js/pg_channel~ PgChannel

new PgChannel()

Source:

Methods

endHandler(endHandler) → {PgChannel}

Set an handler to be called when no more notifications will be received.
Parameters:
Name Type Description
endHandler function the handler
Source:
Returns:
a reference to this, so the API can be used fluently
Type
PgChannel

exceptionHandler(handler) → {PgChannel}

Parameters:
Name Type Description
handler function
Source:
Returns:
Type
PgChannel

fetch(amount) → {ReadStream}

Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.
Parameters:
Name Type Description
amount number
Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream

handler(handler) → {PgChannel}

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
Parameters:
Name Type Description
handler function the handler
Source:
Returns:
a reference to this, so the API can be used fluently
Type
PgChannel

pause() → {PgChannel}

Pause the channel, all notifications are discarded.
Source:
Returns:
a reference to this, so the API can be used fluently
Type
PgChannel

pipe() → {Pipe}

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

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

Source:
Returns:
a pipe
Type
Pipe

pipeTo(dst, handler)

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.

Parameters:
Name Type Description
dst WriteStream the destination write stream
handler function
Source:

resume() → {PgChannel}

Resume the channel.
Source:
Returns:
a reference to this, so the API can be used fluently
Type
PgChannel

subscribeHandler(handler) → {PgChannel}

Set an handler called when the the channel get subscribed.
Parameters:
Name Type Description
handler function the handler
Source:
Returns:
a reference to this, so the API can be used fluently
Type
PgChannel