Interface PgConnectionSupplier

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PgConnectionSupplier
A connection supplier for a PgConnection to a Postgres database that is to be used for a PostgresChannelMessageTableSubscriber.

The supplied connection must not be read from a shared connection pool, typically represented by a DataSource. If a shared connection pool is used, this pool might reclaim a connection that was not closed within a given time frame. This becomes a problem as a PostgresChannelMessageTableSubscriber requires a dedicated Connection to receive notifications from the Postgres database. This connection needs to remain open over a longer period of time. Typically, a PgConnection should be created directly via Driver.connect(String, Properties) and a subsequent call to Wrapper.unwrap(Class).

Since:
6.0
Author:
Rafael Winterhalter
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    org.postgresql.jdbc.PgConnection
    get()
    Supply an open, un-pooled connection to a Postgres database.
  • Method Details

    • get

      org.postgresql.jdbc.PgConnection get() throws SQLException
      Supply an open, un-pooled connection to a Postgres database.
      Returns:
      A dedicated connection to a Postgres database for listening.
      Throws:
      SQLException - If the connection could not be established.