Created 08-29-2016 01:03 PM
Hi:
I have executing this code
public class productor {
public static void main(String[] args) {
Properties properties = new Properties();
properties.put("metadata.broker.list", "xxxxxx:6667");
properties.put("bootstrap.servers", "xxxxxx:6667");
properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");// key serializer
properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); //value serializer
properties.put("acks", "1"); //message durability -- 1 mean ack after writing to leader is success. value of "all" means ack after replication.
properties.put("security.protocol", "PLAINTEXT"); // Security protocol to use for communication.
properties.put("batch.size", "16384");// maximum size of message
KafkaProducer<String,String> producer = new KafkaProducer<String, String>(properties);
try {
for (int i = 0; i < 10; i++) {
// send lots of messages
producer.send(new ProducerRecord<String, String>("RSI","sancho"+i));
System.out.println("RSI"+ " sancho"+i);
}
} catch (Throwable throwable) {
System.out.println(throwable.getMessage());
} finally {
producer.close();
}
}
and receiving this error, what is happening??
run: [2016-08-29 15:05:09,552] ERROR Uncaught error in kafka producer I/O thread: (org.apache.kafka.clients.producer.internals.Sender:136) org.apache.kafka.common.protocol.types.SchemaException: Error reading field 'brokers': Error reading field 'host': Error reading string of length 27758, only 169 bytes available at org.apache.kafka.common.protocol.types.Schema.read(Schema.java:73) at org.apache.kafka.clients.NetworkClient.parseResponse(NetworkClient.java:380) at org.apache.kafka.clients.NetworkClient.handleCompletedReceives(NetworkClient.java:449) at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:269) at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:229) at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:134) at java.lang.Thread.run(Thread.java:745)
Created 09-07-2016 06:04 AM
Created 09-01-2016 06:50 PM
what is the producer and broker versions?
Created 09-07-2016 06:04 AM
Hi:
I resolved the problem opening the port 6667.
Regars
Created 09-07-2016 12:27 PM
thanks, so remember when one client(producer and consumer need to conect to a remote cluster, we need to open the ports from the servers, and also use the same version of kafka client and server)
🙂