Class PgSubscriber
- java.lang.Object
-
- io.vertx.reactivex.pgclient.pubsub.PgSubscriber
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<PgSubscriber>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description PgSubscriber(PgSubscriber delegate)PgSubscriber(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PgConnectionactualConnection()PgChannelchannel(String name)Return a channel for the givenname.voidclose()Close the subscriber, the retry policy will not be invoked.voidclose(Handler<AsyncResult<Void>> handler)Close the subscriber, the retry policy will not be invoked.booleanclosed()PgSubscribercloseHandler(Handler<Void> handler)Set an handler called when the subscriber is closed.PgSubscriberconnect()Connect the subscriber to Postgres.PgSubscriberconnect(Handler<AsyncResult<Void>> handler)Connect the subscriber to Postgres.booleanequals(Object o)PgSubscribergetDelegate()inthashCode()static PgSubscribernewInstance(PgSubscriber arg)PgSubscriberreconnectPolicy(Function<Integer,Long> policy)Set the reconnect policy that is executed when the subscriber is disconnected.io.reactivex.CompletablerxClose()Close the subscriber, the retry policy will not be invoked.io.reactivex.CompletablerxConnect()Connect the subscriber to Postgres.static PgSubscribersubscriber(Vertx vertx, PgConnectOptions options)Create a subscriber.StringtoString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<PgSubscriber> __TYPE_ARG
-
-
Constructor Detail
-
PgSubscriber
public PgSubscriber(PgSubscriber delegate)
-
PgSubscriber
public PgSubscriber(Object delegate)
-
-
Method Detail
-
getDelegate
public PgSubscriber getDelegate()
-
subscriber
public static PgSubscriber subscriber(Vertx vertx, PgConnectOptions options)
Create a subscriber.- Parameters:
vertx- the vertx instanceoptions- the connect options- Returns:
- the subscriber
-
channel
public PgChannel channel(String name)
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
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 io.reactivex.Completable rxConnect()
Connect the subscriber to Postgres.- Returns:
- a reference to this, so the API can be used fluently
-
reconnectPolicy
public PgSubscriber reconnectPolicy(Function<Integer,Long> policy)
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 < 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
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 io.reactivex.Completable rxClose()
Close the subscriber, the retry policy will not be invoked.- Returns:
-
newInstance
public static PgSubscriber newInstance(PgSubscriber arg)
-
-