Class PgConnection

  • All Implemented Interfaces:
    RxDelegate

    public class PgConnection
    extends SqlConnection
    implements RxDelegate
    A connection to Postgres.

    The connection object supports all the operations defined in the interface, it also provides additional support:

    • Notification
    • Request Cancellation

    NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.

    • Constructor Detail

      • PgConnection

        public PgConnection​(PgConnection delegate)
      • PgConnection

        public PgConnection​(Object delegate)
    • Method Detail

      • connect

        public static Future<PgConnection> connect​(io.vertx.reactivex.core.Vertx vertx,
                                                   PgConnectOptions options)
        Connects to the database and returns the connection if that succeeds.

        The connection interracts directly with the database is not a proxy, so closing the connection will close the underlying connection to the database.

        Parameters:
        vertx - the vertx instance
        options - the connect options
        Returns:
        a future notified with the connection or the failure
      • rxConnect

        public static io.reactivex.Single<PgConnection> rxConnect​(io.vertx.reactivex.core.Vertx vertx,
                                                                  PgConnectOptions options)
        Connects to the database and returns the connection if that succeeds.

        The connection interracts directly with the database is not a proxy, so closing the connection will close the underlying connection to the database.

        Parameters:
        vertx - the vertx instance
        options - the connect options
        Returns:
        a future notified with the connection or the failure
      • notificationHandler

        public PgConnection notificationHandler​(Handler<PgNotification> handler)
        Set a handler called when the connection receives notification on a channel.

        The handler is called with the PgNotification and has access to the channel name and the notification payload.

        Parameters:
        handler - the handler
        Returns:
        the transaction instance
      • noticeHandler

        public PgConnection noticeHandler​(Handler<PgNotice> handler)
        Set a handler called when the connection receives a notice from the server.
        Parameters:
        handler -
        Returns:
      • cancelRequest

        public Future<Void> cancelRequest()
        Send a request cancellation message to tell the server to cancel processing request in this connection.
        Note: Use this with caution because the cancellation signal may or may not have any effect.
        Returns:
        a future notified if cancelling request is sent
      • rxCancelRequest

        public io.reactivex.Completable rxCancelRequest()
        Send a request cancellation message to tell the server to cancel processing request in this connection.
        Note: Use this with caution because the cancellation signal may or may not have any effect.
        Returns:
        a future notified if cancelling request is sent
      • processId

        public int processId()
        Returns:
        The process ID of the target backend
      • secretKey

        public int secretKey()
        Returns:
        The secret key for the target backend
      • cast

        public static PgConnection cast​(SqlConnection sqlConnection)
        Cast a to PgConnection. This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.
        Parameters:
        sqlConnection - the connection to cast
        Returns:
        a instance