Skip to content

Instantly share code, notes, and snippets.

@ankitthakur
Created September 6, 2018 05:46
Show Gist options
  • Save ankitthakur/8fc2173aa25fda6bd97d460994c2baf4 to your computer and use it in GitHub Desktop.
Save ankitthakur/8fc2173aa25fda6bd97d460994c2baf4 to your computer and use it in GitHub Desktop.
Kafka Consumer based Rest Controller
package com.thakur.kafkaclient.controller
import com.thakur.kafkaclient.service.KafkaService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("kafka")
class KafkaClientController {
private val service:KafkaService
constructor(service: KafkaService) {
this.service = service
}
@GetMapping("client")
fun helloClient(): String {
return service.clientService()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment