Skip to content

Instantly share code, notes, and snippets.

@ftrossbach
Created December 1, 2017 18:46
Show Gist options
  • Save ftrossbach/8890b1b0a6d4e8a94ff8b9478ce2686d to your computer and use it in GitHub Desktop.
Save ftrossbach/8890b1b0a6d4e8a94ff8b9478ce2686d to your computer and use it in GitHub Desktop.
ExpectedTopicConfiguration expected = new ExpectedTopicConfiguration.ExpectedTopicConfigurationBuilder("test_topic")
.withReplicationFactor(2).build();
Properties props = new Properties();
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
Producer<String,String> producer = KafkaProducerFactory.producer(props, Collections.singleton(expected));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment