Package kafka.javaapi.producer

Examples of kafka.javaapi.producer.Producer


        send(producer, header, topic, message);
    }

    public void processTimer(MetricName name, Timer timer, Context context) {
        final String header = "# time,min,max,mean,median,stddev,95%,99%,99.9%";
        final Producer producer = context.getProducer();
        final Snapshot snapshot = timer.getSnapshot();
        final String topic="%s-metrics-timer".format(prefix);
        final String  message = valueOf(timer.min()) + ',' + timer.max() + ',' + timer.mean() + ',' + snapshot.getMedian() + ','
                + timer.stdDev() + ',' + snapshot.get95thPercentile() + ',' + snapshot.get99thPercentile() + ',' + snapshot.get999thPercentile();
        send(producer, header, topic, message);
View Full Code Here


        send(producer, header, topic, message);
    }

    public void processGauge(MetricName name, Gauge<?> gauge, Context context){
        final String header = "# time,finalue";
        final Producer producer = context.getProducer();
        final String topic = "%s-metrics-gauge".format(prefix);
        final String message = gauge.value().toString();
        send(producer, header, topic, message);
    }
View Full Code Here

            }
        }
    }

    private Producer getActualProducer(MetricName metricName) {
        Producer producer;
        synchronized(producerMap) {
            producer = producerMap.get(metricName);
            if (producer == null) {
                producer = new Producer(producerConfig);
                producerMap.put(metricName, producer);
            }
        }
        return producer;
    }
View Full Code Here

TOP

Related Classes of kafka.javaapi.producer.Producer

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.