title: Spring Kafka Streams - Create Stream vs Inject an existing Stream bean
body: <p>I'm creating a Spring based service with Kafka Streams and noticed for a big consuming time difference when I'm using an existing @Bean KStream VS creating a stream for that stream.</p>
  
  <p>Let's say that I have the following code:</p>
  
  <pre><code>@Autowired
  private StreamsBuilder eventsStreamsBuilder;
  
  @Bean("eventsKStream")
  public KStream&lt;String, String&gt; eventsKStream() {
  
     KStream&lt;String, String&gt; stream = eventsStreamsBuilder.stream(...);
     stream.to("NEW_TOPIC");
     return stream;
  }
  
  // 1. First approach, create a stream for the "NEW_TOPIC" and filter it
  @Bean("eventsFilterKStream")
  public KStream&lt;String, String&gt; eventsFilterKStream() {
     return eventsStreamsBuilder.stream("NEW_TOPIC",....)
     .filter()
  }
  
  // 2. Second approach, inject the existing Stream Bean and filter it
  @Bean("eventsFilterKStream")
  public KStream&lt;String, String&gt; eventsFilterKStream(@Qualifier("eventsKStream") KStream&lt;String, String&gt; eventsKStream) {
     return eventsKStream.filter(...);
  }
  </code></pre>
  
  <p>I have a consumer, using the console consumer... and noticed that for the first approach, it takes few sec for the data to arrive, But in the second approach, I'm getting the filtered data immediately!</p>
  
  <p>Can you please explain me what is the difference? 
  Why the first approache takes a few seconds for the message to arrive to the consumer?
  What is the best approach ?</p>
  
  <p>Thanks!</p>