Class PgSubscriber
java.lang.Object
io.vertx.rxjava3.pgclient.pubsub.PgSubscriber
- All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn a channel for the givenname.close()Close the subscriber, the retry policy will not be invoked.booleanclosed()closeHandler(Handler<Void> handler) Set an handler called when the subscriber is closed.connect()Connect the subscriber to Postgres.booleaninthashCode()static PgSubscribernewInstance(PgSubscriber arg) reconnectPolicy(Function<Integer, Long> policy) Set the reconnect policy that is executed when the subscriber is disconnected.rxClose()Close the subscriber, the retry policy will not be invoked.Connect the subscriber to Postgres.static PgSubscribersubscriber(Vertx vertx, PgConnectOptions options) Create a subscriber.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
PgSubscriber
-
PgSubscriber
-
-
Method Details
-
toString
-
equals
-
hashCode
-
getDelegate
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate
-
subscriber
Create a subscriber.- Parameters:
vertx- the vertx instanceoptions- the connect options- Returns:
- the subscriber
-
channel
Return a channel for the givenname.- 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 == 63characters, and prepared as a quoted identifier without unicode escape sequence support for use inLISTEN/UNLISTENcommands. Examples of channel names and correspondingNOTIFYcommands:- when
name == "the_channel":NOTIFY the_channel, 'msg',NOTIFY The_Channel, 'msg', orNOTIFY "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
- when
- Returns:
- the channel
-
connect
Connect the subscriber to Postgres.- Returns:
- a future notified of the connection success or failure
-
rxConnect
Connect the subscriber to Postgres.- Returns:
- a future notified of the connection success or failure
-
reconnectPolicy
Set the reconnect policy that is executed when the subscriber is disconnected. When the subscriber is disconnected, thepolicyfunction is called with the actual number of retries and returns anamountOfTimevalue:- when
amountOfTime invalid input: '<' 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 afteramountOfTimemilliseconds
- Parameters:
policy- the policy to set- Returns:
- a reference to this, so the API can be used fluently
- when
-
closeHandler
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
- Returns:
- the actual connection to Postgres, it might be
null
-
closed
public boolean closed()- Returns:
- whether the subscriber is closed
-
close
-
rxClose
-
newInstance
-