All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.keyko.monitoring.serde.Web3MonitoringSerdes Maven / Gradle / Ivy

There is a newer version: 0.2.9
Show newest version
package io.keyko.monitoring.serde;

import io.confluent.kafka.serializers.AbstractKafkaAvroSerDeConfig;
import io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde;
import io.keyko.monitoring.schemas.*;

import java.util.Collections;
import java.util.Map;


public class Web3MonitoringSerdes {


  private final static SpecificAvroSerde eventSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde blockSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde eventBlockSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde alertSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde viewSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde viewBlockSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde timeSeriesSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde logSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde logFlattenedSerde = new SpecificAvroSerde<>();
  private final static SpecificAvroSerde flatEventBlockSerde = new SpecificAvroSerde<>();
  protected static Map serdeConfig;


  public static void configureSerdes(String schemaRegistryUrl) {

    serdeConfig = Collections.singletonMap(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);

    eventSerde.configure(serdeConfig, false);
    blockSerde.configure(serdeConfig, false);
    eventBlockSerde.configure(serdeConfig, false);
    alertSerde.configure(serdeConfig, false);
    viewSerde.configure(serdeConfig, false);
    viewBlockSerde.configure(serdeConfig, false);
    timeSeriesSerde.configure(serdeConfig, false);
    logSerde.configure(serdeConfig, false);
    logFlattenedSerde.configure(serdeConfig, false);
    flatEventBlockSerde.configure(serdeConfig, false);
  }

  protected static void configureSerde(SpecificAvroSerde serde) {
    serde.configure(serdeConfig, false);
  }

  public static SpecificAvroSerde getEventSerde() {
    return eventSerde;
  }

  public static SpecificAvroSerde getBlockSerde() {
    return blockSerde;
  }

  public static SpecificAvroSerde getEventBlockSerde() {
    return eventBlockSerde;
  }

  public static SpecificAvroSerde getAlertSerde() {
    return alertSerde;
  }

  public static SpecificAvroSerde getViewSerde() { return viewSerde; }

  public static SpecificAvroSerde getViewBlockSerde() { return viewBlockSerde; }

  public static SpecificAvroSerde getTimeSeriesSerde() { return timeSeriesSerde; }

  public static SpecificAvroSerde getTimeSerieserde() { return timeSeriesSerde; }

  public static SpecificAvroSerde getLogSerde() {
    return logSerde;
  }

  public static SpecificAvroSerde getLogFlattenedSerde() {
    return logFlattenedSerde;
  }

  public static SpecificAvroSerde getFlatEventBlockSerde() {
    return flatEventBlockSerde;
  }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy