Skip to content

Instantly share code, notes, and snippets.

View ankitthakur's full-sized avatar

Ankit Thakur ankitthakur

View GitHub Profile
@ankitthakur
ankitthakur / Person.kt
Created September 3, 2018 13:35
Kotlin based model object using lombok
package com.thakur.kafkaserver.model
import lombok.Getter
import lombok.Setter
import lombok.ToString
@Getter
@Setter
@ToString
data class Person(
@ankitthakur
ankitthakur / StreamsConfig.kt
Created September 3, 2018 13:32
Kafka Stream class, which will be used to configure Kafka Streams and bind it to the topic
package com.thakur.kafkaserver.config
import org.springframework.cloud.stream.annotation.EnableBinding
@EnableBinding(KafkaServerStreams::class)
class StreamsConfig
@ankitthakur
ankitthakur / KafkaServerStreams.kt
Last active September 3, 2018 13:31
Kafka Producer stream interface, which will be used to write to the topic
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
@ankitthakur
ankitthakur / application.properties
Created September 3, 2018 13:15
spring kafka properties
# 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
@ankitthakur
ankitthakur / application.yaml
Created September 3, 2018 13:09
kafka stream binding as producer
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
@ankitthakur
ankitthakur / DockerController.kt
Created August 28, 2018 05:01
Basic Springboot based kotlin RestController
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("/")
@ankitthakur
ankitthakur / Dockerfile
Created August 28, 2018 04:59
Docker file
FROM openjdk:8-jdk-alpine
EXPOSE 8080
ADD /build/libs/dockerdemo-0.0.1-SNAPSHOT.jar dockerdemo.jar
ENTRYPOINT ["java", "-jar", "dockerdemo.jar"]
@ankitthakur
ankitthakur / build.gradle
Created August 28, 2018 04:58
gradle kotlin docker task
buildscript {
ext {
kotlinVersion = '1.2.51'
springBootVersion = '2.0.4.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
@ankitthakur
ankitthakur / rm_mysql.md
Created May 18, 2018 09:43 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@ankitthakur
ankitthakur / 0_reuse_code.js
Created March 4, 2016 12:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console