Last active
October 16, 2018 16:45
-
-
Save adekunleba/1697e1ad1db389e6d0318217f3866044 to your computer and use it in GitHub Desktop.
Configure Producer to connect to Confluence
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
| import org.apache.kafka.clients.producer.KafkaProducer | |
| import org.apache.kafka.streams.{StreamBuilder, StreamsConfig} | |
| import java.util.Properties | |
| val config: Properties = { | |
| val p = new Properties() | |
| p.put(StreamsConfig.APPLICATION_ID_CONFIG, "simple-confluent-stream") | |
| p.put(StreamsConfig.CLIENT_ID_CONFIG, "simple-confluent-stream-client") | |
| p.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092") | |
| p.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer") | |
| p.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer") | |
| p | |
| } | |
| //You can make use of the config in creating a stream as shown | |
| val streams = new KafkaProducer[String, String](config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment