Class PgSubscriber
- All Implemented Interfaces:
MutinyDelegate
LISTEN/UNLISTEN to Postgres channels.
The subscriber manages a single connection to Postgres.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- See Also:
-
PgSubscriber
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPgSubscriber(io.vertx.pgclient.pubsub.PgSubscriber delegate) Create a new instance ofPgSubscriberdelegating to the given (non-null) instance ofPgSubscriber.PgSubscriber(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionReturn a channel for the givenname.io.smallrye.mutiny.Uni<Void>close()Close the subscriber, the retry policy will not be invoked.voidClose the subscriber, the retry policy will not be invoked.Close the subscriber, the retry policy will not be invoked.booleanclosed()closeHandler(Runnable handler) Set an handler called when the subscriber is closed.io.smallrye.mutiny.Uni<Void>connect()Connect the subscriber to Postgres.voidConnect the subscriber to Postgres.Connect the subscriber to Postgres.booleanio.vertx.pgclient.pubsub.PgSubscriberGet the delegate instance.inthashCode()static PgSubscribernewInstance(io.vertx.pgclient.pubsub.PgSubscriber delegate) Creates a new instance of thePgSubscriber.reconnectPolicy(Function<Integer, Long> policy) Set the reconnect policy that is executed when the subscriber is disconnected.static PgSubscribersubscriber(Vertx vertx, io.vertx.pgclient.PgConnectOptions options) Create a subscriber.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
PgSubscriber
public PgSubscriber(io.vertx.pgclient.pubsub.PgSubscriber delegate) Create a new instance ofPgSubscriberdelegating to the given (non-null) instance ofPgSubscriber. -
PgSubscriber
-
-
Method Details
-
getDelegate
public io.vertx.pgclient.pubsub.PgSubscriber getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
connect
Connect the subscriber to Postgres.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
PgSubscriber.connect()
-
connectAndAwait
public void connectAndAwait()Connect the subscriber to Postgres.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- See Also:
-
PgSubscriber.connect()
-
connectAndForget
Connect the subscriber to Postgres.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
PgSubscriber.connect()
-
close
Close the subscriber, the retry policy will not be invoked.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
PgSubscriber.close()
-
closeAndAwait
public void closeAndAwait()Close the subscriber, the retry policy will not be invoked.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- See Also:
-
PgSubscriber.close()
-
closeAndForget
Close the subscriber, the retry policy will not be invoked.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
PgSubscriber.close()
-
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
-
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 < 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
-
newInstance
Creates a new instance of thePgSubscriber. -
hashCode
public int hashCode() -
equals
-
toString
-