Interface PgConnection

    • Method Detail

      • connect

        static Future<PgConnection> connect​(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

        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

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

        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
      • processId

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

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

        PgConnection closeHandler​(Handler<Void> handler)
        Set an handler called when the connection is closed.
        Specified by:
        closeHandler in interface SqlConnection
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently