title: Replay Kafka topic with Server-Sent-Events
body: <p>I'm thinking about the following use-case and would like to validate if this approach is conceptually valid.</p>
  <p>The goal is to expose a long-running <em>Server-Sent-Event</em> (SSE) endpoint in Spring replaying the same Kafka topic for each incoming connection (with some user-specific filtering).</p>
  <p>The SSE is exposed in this way:</p>
  <pre><code>  @GetMapping(&quot;/sse&quot;)
    public SseEmitter sse() {
      SseEmitter sseEmitter = new SseEmitter();
  
      Executors
            .newSingleThreadExecutor()
            .execute(() -&gt; dummyDataProducer.generate()  // kafka ultimately
                  .forEach(payload -&gt; {
                    try {
                      sseEmitter.send(payload);
                    } catch (IOException ex) {
                      sseEmitter.completeWithError(ex);
                    }
                  }));
  
      return sseEmitter;
    }
  </code></pre>
  <p>From the other side, there is a <code>KafkaListener</code> method (<code>ConcurrentKafkaListenerContainerFactory</code> is used) :</p>
  <pre><code>  @KafkaListener(topics = &quot;${app.kafka.topic1}&quot;)
    public void receive(
          @Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) Integer id,
          @Payload Object payload) {
      // do something ...
    }
  </code></pre>
  <p>As far as I know, the Kafka consumer application uses one thread for reading data from a single topic. This somehow violates the idea of using SSE, where for each incoming connection a dedicated long-running thread is created.</p>
  <p>Is it a valid approach for this use-case? If so, how to accomplish this properly?</p>