Unify PubSub Handler Signature
Motivation
Right now the PubSub handlers are split into three separate closures, with the subscribe/unsubscribe handlers being optional. This won't play well with AsyncStream for being able to respond to all events that a PubSub subscription can cause.
Additionally, the current structure is very verbose in code to maintain - but also adds complexity to developers who are first getting started to understand the lifecycle of PubSub events.
Changes
- Add: New
RedisPubSubEventenum that captures the subscribe, unsubscribe, and message lifecycle events - Add: New
RedisPubSubEventReceiverthat combines the previous 3 closure types - Add: Dedicated DocC Symbol Extension file for
RedisPubSubHandler - Change:
RedisClient.subscribeandRedisClient.psubscribemethod signatures to only require a single unlabeled closure - Rename:
RedisUnsubscribeEventSourcetoRedisPubSubEvent.UnsubscribeEventSource - Remove:
RedisSubscriptionMessageReceiver,RedisSubscriptionChangeDetails,RedisSubscribeHandler, andRedisUnsubscribeHandlertypes
Result
Developers should have a much easier time getting started and understanding PubSub with assistance from the compiler with types to understand what they're being given and what's available to them as information to make more informed decisions in their app logic.