if (Boolean.valueOf(properties.getProperty(ConfigurationKeys.METRICS_REPORTING_KAFKA_USE_SCHEMA_REGISTRY, ConfigurationKeys.DEFAULT_METRICS_REPORTING_KAFKA_USE_SCHEMA_REGISTRY))) { kafkaAvroEventReporterBuilder.withSchemaRegistry(new KafkaAvroSchemaRegistry(properties));
KafkaEventReporter kafkaReporter = KafkaAvroEventReporter.forContext(context).withKafkaPusher(pusher) .withSchemaRegistry(registry).build("localhost:0000", "topic");
/** * Get a {@link org.apache.gobblin.metrics.kafka.KafkaEventReporter.Builder} for this reporting format. * @param context {@link MetricContext} that should be reported. * @param properties {@link Properties} containing information to build reporters. * @return {@link org.apache.gobblin.metrics.kafka.KafkaEventReporter.Builder}. */ public KafkaEventReporter.Builder<?> eventReporterBuilder(MetricContext context, Properties properties) { switch (this) { case AVRO: KafkaAvroEventReporter.Builder<?> builder = KafkaAvroEventReporter.Factory.forContext(context); if (Boolean.valueOf(properties.getProperty(ConfigurationKeys.METRICS_REPORTING_KAFKA_USE_SCHEMA_REGISTRY, ConfigurationKeys.DEFAULT_METRICS_REPORTING_KAFKA_USE_SCHEMA_REGISTRY))) { builder.withSchemaRegistry(new KafkaAvroSchemaRegistry(properties)); } return builder; case JSON: return KafkaEventReporter.Factory.forContext(context); default: // This should never happen. throw new IllegalArgumentException("KafkaReportingFormat not recognized."); } } }