7c88cd5d613e39246a118347130c539463f7d062
[JavaForFun] /
1 package de.example.spring.kafka;
2
3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory;
5 import org.springframework.cloud.stream.annotation.EnableBinding;
6 import org.springframework.cloud.stream.annotation.StreamListener;
7 import org.springframework.cloud.stream.messaging.Sink;
8
9 @EnableBinding(Sink.class)
10 public class Receiver {
11   private static final Logger LOGGER = LoggerFactory.getLogger(Receiver.class);
12
13   @StreamListener(Sink.INPUT)
14   public void handle(Product product) {
15     LOGGER.info("product name='{}'", product.getName());
16     LOGGER.info("product description='{}'", product.getDescription());
17   }
18
19 }