Class RedisPubSubProvider.Dispatcher

  • Enclosing class:
    RedisPubSubProvider

    public class RedisPubSubProvider.Dispatcher
    extends redis.clients.jedis.JedisPubSub
    Subscribes to the provided Redis channel pattern and dispatches received messages. Method #run must be called in a new thread.
    • Field Detail

      • pattern

        protected final String pattern
      • stop

        protected volatile boolean stop
    • Constructor Detail

      • Dispatcher

        public Dispatcher​(String pattern)
    • Method Detail

      • awaitSubscribed

        public boolean awaitSubscribed​(long timeout,
                                       TimeUnit unit)
        To be called from the main thread to wait for subscription to be effective.
      • run

        public void run()
        To be called from a new thread to do the actual Redis subscription and to dispatch messages.
      • close

        public void close()
        To be called from the main thread to stop the subscription.
      • onPSubscribe

        public void onPSubscribe​(String pattern,
                                 int subscribedChannels)
        Overrides:
        onPSubscribe in class redis.clients.jedis.JedisPubSub
      • onMessage

        public void onMessage​(String channel,
                              byte[] message)
      • onPMessage

        public void onPMessage​(String pattern,
                               String channel,
                               byte[] message)
      • proceed

        public void proceed​(redis.clients.jedis.Client client,
                            String... channels)
        Overrides:
        proceed in class redis.clients.jedis.JedisPubSub
      • proceedWithPatterns

        public void proceedWithPatterns​(redis.clients.jedis.Client client,
                                        String... patterns)
        Overrides:
        proceedWithPatterns in class redis.clients.jedis.JedisPubSub
      • flush

        protected void flush​(redis.clients.jedis.Client client)
      • processBinary

        protected void processBinary​(redis.clients.jedis.Client client)
      • toString

        protected String toString​(byte[] bytes)