This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM openjdk:8-jdk-alpine | |
| EXPOSE 8080 | |
| ADD /build/libs/dockerdemo-0.0.1-SNAPSHOT.jar dockerdemo.jar | |
| ENTRYPOINT ["java", "-jar", "dockerdemo.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.thakur.dockerdemo.controller | |
| import org.springframework.web.bind.annotation.RequestMapping | |
| import org.springframework.web.bind.annotation.RestController | |
| @RestController | |
| @RequestMapping("/docker/api") | |
| class DockerController { | |
| @RequestMapping("/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spring: | |
| cloud: | |
| stream: | |
| kafka: | |
| binder: | |
| brokers: localhost:9092 #kafkahost:kafkaport | |
| bindings: | |
| kafkatopic1: # this is particular topic, we will create in spring to create connection | |
| destination: test # name of the topic | |
| contentType: application/json # what sort of data, we want to send in message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # kafkahost:kafkaport | |
| spring.cloud.stream.kafka.binder.brokers="localhost:9092" | |
| # kafkatopic1 is the stream, will create, and the stream will get the destination or topic name from here | |
| # test is the topic name | |
| spring.cloud.stream.bindings.kafkatopic1.destination=test | |
| # kafkatopic1 is the stream, where we will define in what sort, we will send data | |
| spring.cloud.stream.bindings.kafkatopic1.content-type=application/json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.thakur.kafkaserver.config | |
| import org.springframework.cloud.stream.annotation.Output | |
| import org.springframework.messaging.MessageChannel | |
| interface KafkaServerStreams { | |
| @Output(PRODUCER_STREAM) | |
| fun producerChannel(): MessageChannel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.thakur.kafkaserver.config | |
| import org.springframework.cloud.stream.annotation.EnableBinding | |
| @EnableBinding(KafkaServerStreams::class) | |
| class StreamsConfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.thakur.kafkaserver.model | |
| import lombok.Getter | |
| import lombok.Setter | |
| import lombok.ToString | |
| @Getter | |
| @Setter | |
| @ToString | |
| data class Person( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.thakur.kafkaserver.service | |
| import com.thakur.kafkaserver.config.KafkaServerStreams | |
| import com.thakur.kafkaserver.model.Person | |
| import org.slf4j.Logger | |
| import org.slf4j.LoggerFactory | |
| import org.springframework.messaging.MessageHeaders | |
| import org.springframework.messaging.support.MessageBuilder | |
| import org.springframework.stereotype.Service | |
| import org.springframework.util.MimeTypeUtils |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.thakur.kafkaserver.restcontroller | |
| import com.thakur.kafkaserver.model.Person | |
| import com.thakur.kafkaserver.service.KafkaService | |
| import org.springframework.http.HttpStatus | |
| import org.springframework.web.bind.annotation.GetMapping | |
| import org.springframework.web.bind.annotation.RequestMapping | |
| import org.springframework.web.bind.annotation.ResponseStatus | |
| import org.springframework.web.bind.annotation.RestController | |
| import java.util.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spring: | |
| cloud: | |
| stream: | |
| kafka: | |
| binder: | |
| brokers: localhost:9092 | |
| spring.kafka.topic: test | |
| spring.kafka.topic.groupId: testgroup |