1 package de.example.spring.kafka;
3 import javax.inject.Inject;
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
7 import org.springframework.cloud.stream.annotation.EnableBinding;
8 import org.springframework.cloud.stream.annotation.StreamListener;
9 import org.springframework.cloud.stream.messaging.Sink;
11 @EnableBinding(Sink.class)
12 public class Receiver {
13 private static final Logger LOGGER = LoggerFactory.getLogger(Receiver.class);
15 private final DummyService dummyService;
18 public Receiver(DummyService dummyService) {
19 this.dummyService = dummyService;
22 @StreamListener(Sink.INPUT)
23 public void handle(Product product) {
24 LOGGER.info("product name='{}'", product.getName());
25 LOGGER.info("product description='{}'", product.getDescription());
27 dummyService.iAmVeryDummy(product.getName());