Spring Boot example with REST and Kafka Streams

If you’re looking to build a REST service with integrations into Kafka Streams, check out this example which is part of a broader DevOps project over at Confluent.

It includes an example REST Service, which is super easy in Spring Boot using Java annotations:

@GetMapping(value = "/orders/{id}",
produces = "application/json")
public DeferredResult<ResponseEntity<Order>> getOrder(@PathVariable String id, @RequestParam Optional<Long> timeout)

And a Streams Topology which is crazy simple with Dependency Injection provided by Spring Boot

@Autowired
public void orderTable(final StreamsBuilder builder) {

Also there is an example of how you could use standard Java / Kafka properties files to configuration the application using the Spring configuration reference syntax…

# Spring Kafka
spring.kafka.properties.bootstrap.servers=${bootstrap.servers}