title: How to continuosly listen on redis stream using lettuce java library
body: <p>I am trying to listen on a redis stream and process the message as and when they arrive. I am using async command and I expect the message to be pushed instead of being pulled. So I don't think a while loop is required. But the following code seems to not work.</p>
  <pre><code>public static void main(String[] args) throws InterruptedException {
  
      RedisClient redisClient = RedisClient
          .create(&quot;redis://localhost:6379/&quot;);
      StatefulRedisConnection&lt;String, String&gt; connection
          = redisClient.connect();
      RedisAsyncCommands commands = connection.async();
      commands.xgroupCreate(StreamOffset.latest(&quot;my-stream&quot;), &quot;G1&quot;, new XGroupCreateArgs());
      commands
          .xreadgroup(Consumer.from(&quot;G1&quot;, &quot;c1&quot;), StreamOffset.lastConsumed(&quot;my-stream&quot;))
          .thenAccept(System.out::println);
  
      Thread.currentThread().join();
  }
  </code></pre>
  <p>It just prints whatever the stream has when the program starts and does not print the messages that are added when the program is running. Isn't the callback supposed to be called for every message that is newly added into the stream?</p>