/** * Builds and returns {@link KafkaEventReporter}. * * @param brokers string of Kafka brokers * @param topic topic to send metrics to * @return KafkaReporter */ public KafkaEventReporter build(String brokers, String topic) throws IOException { this.brokers = brokers; this.topic = topic; return new KafkaEventReporter(this); }
public KafkaEventReporter(Builder<?> builder) throws IOException { super(builder); this.serializer = this.closer.register( createSerializer(new FixedSchemaVersionWriter())); if(builder.kafkaPusher.isPresent()) { this.kafkaPusher = builder.kafkaPusher.get(); } else { String pusherClassName = builder.pusherClassName.or(PusherUtils.DEFAULT_KAFKA_PUSHER_CLASS_NAME); this.kafkaPusher = PusherUtils.getPusher(pusherClassName, builder.brokers, builder.topic, builder.config); } this.closer.register(this.kafkaPusher); }
kafkaReporter.report();
kafkaReporter.report();
public KafkaEventReporter(Builder<?> builder) throws IOException { super(builder); this.serializer = this.closer.register( createSerializer(new FixedSchemaVersionWriter())); if(builder.kafkaPusher.isPresent()) { this.kafkaPusher = builder.kafkaPusher.get(); } else { String pusherClassName = builder.pusherClassName.or(PusherUtils.DEFAULT_KAFKA_PUSHER_CLASS_NAME); this.kafkaPusher = PusherUtils.getPusher(pusherClassName, builder.brokers, builder.topic, builder.config); } this.closer.register(this.kafkaPusher); }
/** * Builds and returns {@link KafkaEventReporter}. * * @param brokers string of Kafka brokers * @param topic topic to send metrics to * @return KafkaReporter */ public KafkaEventReporter build(String brokers, String topic) throws IOException { this.brokers = brokers; this.topic = topic; return new KafkaEventReporter(this); }
kafkaReporter.report();