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 using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPgSubscriber
(io.vertx.pgclient.pubsub.PgSubscriber delegate) PgSubscriber
(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>
close()
Close the subscriber, the retry policy will not be invoked.Blocking variant ofclose()
.void
Variant ofclose()
that ignores the result of the operation.boolean
closed()
closeHandler
(Runnable handler) io.smallrye.mutiny.Uni<Void>
connect()
Connect the subscriber to Postgres.Blocking variant ofconnect()
.Variant ofconnect()
that ignores the result of the operation.boolean
io.vertx.pgclient.pubsub.PgSubscriber
int
hashCode()
static PgSubscriber
newInstance
(io.vertx.pgclient.pubsub.PgSubscriber arg) reconnectPolicy
(Function<Integer, Long> policy) static PgSubscriber
subscriber
(Vertx vertx, io.vertx.pgclient.PgConnectOptions options) toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
PgSubscriber
public PgSubscriber(io.vertx.pgclient.pubsub.PgSubscriber delegate) -
PgSubscriber
-
-
Method Details
-
getDelegate
public io.vertx.pgclient.pubsub.PgSubscriber getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
subscriber
- Parameters:
vertx
- the vertx instanceoptions
- the connect options- Returns:
- the subscriber
-
channel
- 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 == 63
characters, and prepared as a quoted identifier without unicode escape sequence support for use inLISTEN/UNLISTEN
commands. Examples of channel names and correspondingNOTIFY
commands:- 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.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
Blocking variant ofconnect()
.This method waits 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 a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
connectAndForget
Variant ofconnect()
that ignores the result of the operation.This method subscribes on the result of
connect()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect()
but you don't need to compose it with other operations.- Returns:
- the instance of PgSubscriber to chain method calls.
-
reconnectPolicy
- Parameters:
policy
- the policy to set- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
- Parameters:
handler
- the handler- Returns:
-
actualConnection
- Returns:
- the actual connection to Postgres, it might be
null
-
closed
public boolean closed()- Returns:
- whether the subscriber is closed
-
close
Close the subscriber, the retry policy will not be invoked.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
Blocking variant ofclose()
.This method waits 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 a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget() -
newInstance
-