package com.fshark.overseas.advert.processor;

import com.fshark.overseas.advert.modle.SinkMetricEvent;
import com.fshark.overseas.advert.modle.metrics.ActivationMetrics;
import com.fshark.overseas.advert.modle.metrics.RemainMetrics;
import com.fshark.overseas.advert.util.Constants;
import com.google.gson.Gson;
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.common.functions.RichFlatMapFunction;
import org.apache.flink.util.Collector;

public class MetricJsonToObProcessor extends RichFlatMapFunction<SinkMetricEvent, ActivationMetrics> {


    @Override
    public void flatMap(SinkMetricEvent value, Collector<ActivationMetrics> out) throws Exception {
        if (Constants.TYPE_SINK_METRIC.equals(value.getEventType()) && value.getEventData() != null) {
            out.collect(value.getEventData());
        }
    }
}
