postgres-nio icon indicating copy to clipboard operation
postgres-nio copied to clipboard

Support async Listen/Notify API

Open fabianfett opened this issue 3 years ago • 1 comments

The current Listen/Notify is not usable in a structured concurrency context. We should provide something better:

Goals

  1. Provide a new method on connection:

    public func listen(_ channel: String) async throws -> PostgresNotificationSequence
    
  2. The new PostgresNotificationSequence can be backed by an AsyncThrowingStream<String> internally. However we should not expose this, as this gives us greater flexibility down the road.

  3. We should create a ListenStateMachine in the PostgresConnection that we update for each Listen channel.

fabianfett avatar Mar 13 '22 16:03 fabianfett

Work has started in #264.

fabianfett avatar Mar 14 '22 12:03 fabianfett