import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.rapidoid.net.Server;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Properties;

public class HttpGateEntryPoint {

    public static void main(String[] args) throws Exception {
        Properties props = new Properties();
        props.put("bootstrap.servers", "edi15:9092");
        props.put("acks", "0");
        props.put("retries", 0);
        props.put("linger.ms", 10);
        props.put("batch.size", 64 * 1000);
        props.put("buffer.memory", 128 * 1000 * 1000);
        props.put("compression.type", "lz4");
        props.put("key.serializer", "io.confluent.kafka.serializers.KafkaAvroSerializer");
        props.put("value.serializer", "io.confluent.kafka.serializers.KafkaAvroSerializer");
        props.put("schema.registry.url", "http://edi15:8881");
        String schemaString = "{\"type\": \"record\", " +
                "\"name\": \"kevent\"," +
                "\"fields\": [" +
//                "{\"name\": \"timestamp\", \"type\": \"long\"}," +
                "{\"name\": \"payload\", \"type\": \"bytes\"}" +
                "]}";
        Producer<String, GenericRecord> producer = new KafkaProducer<>(props);
        Schema.Parser parser = new Schema.Parser();
        Schema schema = parser.parse(schemaString);
        Server server = new KHttpServer(schema, producer).listen(8888);
        new BufferedReader(new InputStreamReader(System.in)).readLine();
        server.shutdown();
        producer.close();
    }
}
@@ -597,17 +597,17 @@
 er.ms%22, 
-1
+2
 0);%0A    
@@ -685,71 +685,286 @@
 y%22, 
-128 * 1000 * 1000);%0A        props.put(%22compression.type%22, %22lz4%22
+256 * 1000 * 1000);%0A        props.put(%22max.request.size%22, 10 * 1000 * 1000);%0A        props.put(%22compression.type%22, %22lz4%22);%0A        props.put(%22metadata.fetch.timeout.ms%22, 100);%0A        props.put(%22max.block.ms%22, 100);%0A        props.put(%22max.in.flight.requests.per.connection%22, 100
 );%0A 

set tight timeouts; increase max request size