title: How to inject KafkaTemplate in Quarkus
body: <p>I'm trying to inject a <code>KafkaTemplate</code> to send a single message. I'm developing a small function that lies outside the reactive approach.</p>
  
  <p>I can only find examples that use <code>@Ingoing</code> and <code>@Outgoing</code> from Smallrye but I don't need a <code>KafkaStream</code>.</p>
  
  <p>I tried with Kafka-CDI but I'm unable to inject the <code>SimpleKafkaProducer</code>.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>For Clement's answer</strong></p>
  
  <p>It seems the right direction, but executing <code>orders.send("hello");</code> I receive this error: </p>
  
  <pre><code>(vert.x-eventloop-thread-3) Unhandled exception:java.lang.IllegalStateException: Stream not yet connected
  </code></pre>
  
  <p>I'm consuming from my topic by command line, Kafka is up and running, if I produce manually I can see the consumed messages.</p>
  
  <p>It seems relative to this sentence by the doc:</p>
  
  <blockquote>
    <p>To use an Emitter for the stream hello, you need a @Incoming("hello")
    somewhere in your code (or in your configuration).</p>
  </blockquote>
  
  <p>I have this code in my class:</p>
  
  <pre><code>    @Incoming("orders")
      public CompletionStage&lt;Void&gt; consume(KafkaMessage&lt;String, String&gt; msg) {
          log.info("Received message (topic: {}, partition: {}) with key {}: {}", msg.getTopic(), msg.getPartition(), msg.getKey(), msg.getPayload());
          return msg.ack();
      }
  </code></pre>
  
  <p>Maybe I've forgotten some configurations?</p>