</execution>
</executions>
</plugin>
- <plugin>
- <groupId>pl.project13.maven</groupId>
- <artifactId>git-commit-id-plugin</artifactId>
- </plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.kafka.core.KafkaTemplate;
-import org.springframework.kafka.support.SendResult;
-import org.springframework.util.concurrent.ListenableFuture;
+// tag::supersimple[]
@Slf4j
@SpringBootApplication
public class Application implements ApplicationRunner
{
for (int i = 0; i < 100; i++)
{
- // tag::callback[]
- ListenableFuture<SendResult<String, String>> listenableFuture =
- kafkaTemplate.send("test", Long.toString(i%10), Long.toString(i));
-
- listenableFuture.addCallback(
- result -> log.info(
- "Sent {}={} to partition={}, offset={}",
- result.getProducerRecord().key(),
- result.getProducerRecord().value(),
- result.getRecordMetadata().partition(),
- result.getRecordMetadata().offset()),
- e -> log.error("ERROR sendig message", e));
- // end::callback[]
+ kafkaTemplate.send("test", Long.toString(i%10), Long.toString(i));
}
}
SpringApplication.run(Application.class, args);
}
}
+// end::supersimple[]