title: jedis pubsub and timeouts: how to listen infinitely as subscriber?
body: <p>I'm struggling with the concept of creating a Jedis-client which listens infinitely as a subscriber to a Redis pubsub channel and handles messages when they come in. </p>
  
  <p>My problem is that after a while of inactivity the server stops responding silently. I think this is due to a timeout occurring on the Jedis-client I subscribe with. </p>
  
  <p>Would this likely indeed be the case? If so, is there a way to configure this particular Jedis-client to not timeout? (While other Jedispools aren't affected with some globally set timeout) 
  Alternatively, is there another (best practice) way of what I'm trying to achieve? </p>
  
  <p>This is my code, (modified/ stripped for display) : </p>
  
  <p><strong>executed during web-server startup:</strong> </p>
  
  <p><code>new Thread(AkkaStarter2.getSingleton()).start();</code></p>
  
  <p><strong>AkkaStarter2.java</strong></p>
  
  <pre><code>   private Jedis sub;
     private AkkaListener akkaListener;
  
     public static AkkaStarter2 getSingleton(){
        if(singleton==null){
          singleton = new AkkaStarter2();
        }
        return singleton;
      }
  
      private AkkaStarter2(){
        sub = new Jedis(REDISHOST, REDISPORT);
        akkaListener = new AkkaListener();
      }
  
      public void run() {
        //blocking
        sub.psubscribe(akkaListener, AKKAPREFIX + "*");
      }
  
      class AkkaListener extends JedisPubSub {
          ....
          public void onPMessage(String pattern, String akkaChannel,String jsonSer) {
            ...
          }
      }
  </code></pre>
  
  <p>Thanks.</p>