O'Reilly logo
  • Ashish Kaushal thinks this is interesting:

The simplest way to send a message is as follows:


Cover of Kafka: The Definitive Guide


First we instantiated Producer with kafka.properties config file that have bootstrap.server, key.serializer, value.serializer, as, producer = new KafkaProducer('<kafka.properties file>') Create ProducerRecord record = new ProducerRecord("Topic", "CustomerCountry", "France") producer.send(record) In try catch we are just getting exception that are encountered before sending the message to Kafka We are Ignoring the ReturnMetadata so no ack for msg and also ignoring Java Future object for get()