use of org.apache.inlong.sort.flink.SourceEvent.SourceEventType in project incubator-inlong by apache.
the class MultiTopicPulsarSourceFunction method processEvent.
private void processEvent(SourceEvent sourceEvent) throws Exception {
SourceEventType sourceEventType = sourceEvent.getSourceEventType();
PulsarSourceInfo pulsarSourceInfo = (PulsarSourceInfo) sourceEvent.getSourceInfo();
Map<String, Object> properties = sourceEvent.getProperties();
long dataFlowId = sourceEvent.getDataFlowId();
switch(sourceEventType) {
case ADDED:
PulsarSourceFunction<SerializedRecord> pulsarSourceFunction = generateSourceFunction(dataFlowId, properties, pulsarSourceInfo);
pulsarConsumer.addPulsarSource(dataFlowId, pulsarSourceFunction);
break;
case UPDATE:
PulsarSourceFunction<SerializedRecord> updateSourceFunction = generateSourceFunction(dataFlowId, properties, pulsarSourceInfo);
pulsarConsumer.updatePulsarSource(dataFlowId, updateSourceFunction);
break;
case REMOVED:
pulsarConsumer.removePulsarSource(dataFlowId);
break;
default:
LOG.error("Unknown source event type {}", sourceEvent.getSourceEventType());
throw new RuntimeException("Unknown source event type " + sourceEvent.getSourceEventType());
}
}
Aggregations