Add support for PubSub
Motivation:
One of the great features of Redis is being able to subscribe and receive messages published to specific channels as a way of acting as a message queue for processing jobs.
PubSub requires a specific understanding of the connection model that can only be implemented directly in this library.
Modifications:
- Add:
RedisPubSubHandler
to sit in front ofRedisCommandHandler
to manage subscription callbacks and Redis registration - Add:
publish
and thepubsub
commands - Add:
addPubSubHandler
extension toNIO.Channel
- Add: Type-safe String wrapper of
RedisChannelName
for PubSub methods - Add:
pubsubSubscriptionNotFound
error case - Add:
isSubscribed
property toRedisConnection
- Add:
availableConnectionCount
andleasedConnectionCount
properties toRedisConnectionPool
- Add: Metrics for PubSub
- Add:
makeNewPool
factory method toRedisConnectionPoolIntegrationTestCase
- Change:
RedisClient
to require methods for PubSub management, as they are intrinsicly tied to the client's connection model - Change: Parsing of
PING
response for handling special case in PubSub mode - Rename:
ActiveConnectionGauge
toRedisMetrics.IncrementalGauge
Result:
Developers will now be able to use Redis in PubSub mode with both connections and pools.
This resolves #6 (closed)
Edited by Nathan Harris