Package kafka.producer

Examples of kafka.producer.ProducerConfig


    }
    final Producer<String, String> kafkaProducer;

    public SoProducer()  {

        kafkaProducer = new Producer<String, String>(new ProducerConfig(prop));
    }
View Full Code Here


        props.put("serializer.class", serializerClass);
        props.put("serializer.class", "kafka.serializer.StringEncoder");
        props.put("producer.type", "sync");
        props.put("batch.size", "1");

        ProducerConfig config = new ProducerConfig(props);
        return new Producer<String, String>(config);
    }
View Full Code Here

        props.put("metadata.broker.list", brokerConnectString);
        props.put("serializer.class", serializerClass);
        props.put("producer.type", "sync");
        props.put("batch.size", "1");

        ProducerConfig config = new ProducerConfig(props);
        producer = new Producer<String, String>(config);

        this.context = context;
        this.collector = collector;
    }
View Full Code Here

        Properties props = new Properties();
        props.put("metadata.broker.list", "localhost:9092");
        props.put("serializer.class", "kafka.serializer.StringEncoder");
        props.put("producer.type", "async");
        props.put("batch.size", "1");
        ProducerConfig config = new ProducerConfig(props);

        return new Producer<String, String>(config);
    }
View Full Code Here

        Properties props = new Properties();
        props.put("zk.connect", zkConnectString);
        props.put("serializer.class", "kafka.serializer.StringEncoder");
        props.put("producer.type", "async");
        props.put("batch.size", "1");
        ProducerConfig config = new ProducerConfig(props);

        producer = new Producer<String, String>(config);
    }
View Full Code Here

    private void emitBatch() {
        Properties props = new Properties();
        props.put("metadata.broker.list", "localhost:9092");
        props.put("serializer.class", "kafka.serializer.StringEncoder");
        props.put("request.required.acks", "1");
        ProducerConfig config = new ProducerConfig(props);
        Producer<String, String> producer = new Producer<String, String>(config);

        for (String sentence : sentences) {
            KeyedMessage<String, String> data =
                    new KeyedMessage<String, String>(topicName, sentence);
View Full Code Here

        Properties props = new Properties();
        props.put("metadata.broker.list", "localhost:9092");
        props.put("serializer.class", "kafka.serializer.StringEncoder");
        props.put("producer.type", "async");
        props.put("batch.size", "1");
        ProducerConfig config = new ProducerConfig(props);

        producer = new Producer<String, String>(config);
    }
View Full Code Here

                                        Long.toString(LoggingConfiguration.DEFAULT_KAFKA_PROCUDER_BUFFER_MS)));
    props.setProperty(LoggingConfiguration.NUM_PARTITIONS,
                      configuration.get(LoggingConfiguration.NUM_PARTITIONS,
                                        LoggingConfiguration.DEFAULT_NUM_PARTITIONS));

    ProducerConfig config = new ProducerConfig(props);

    try {
      kafkaTopic = KafkaTopic.getTopic();
    } catch (IOException e) {
      throw Throwables.propagate(e);
View Full Code Here

                .put("key.serializer.class", NumberEncoder.class.getName())
                .put("partitioner.class", NumberPartitioner.class.getName())
                .put("request.required.acks", "1")
                .build();

        ProducerConfig producerConfig = new ProducerConfig(toProperties(properties));
        return new CloseableProducer<>(producerConfig);
    }
View Full Code Here

  {
    props.put("serializer.class", "kafka.serializer.StringEncoder");
    props.put("zk.connect", "localhost:2181");
    // Use random partitioner. Don't need the key type. Just set it to Integer.
    // The message is of type String.
    producer = new kafka.javaapi.producer.Producer<Integer, String>(new ProducerConfig(props));
    this.topic = topic;
  }
View Full Code Here

TOP

Related Classes of kafka.producer.ProducerConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.