use of org.apache.inlong.sort.flink.multitenant.MultiTenantFunctionInitializationContext in project incubator-inlong by apache.
the class MultiTopicPulsarSourceFunction method generateSourceFunction.
public PulsarSourceFunction<SerializedRecord> generateSourceFunction(long dataFlowId, Map<String, Object> properties, PulsarSourceInfo pulsarSourceInfo) throws Exception {
org.apache.flink.configuration.Configuration config = new org.apache.flink.configuration.Configuration();
putMapToConfig(config, properties);
PulsarSourceFunction<SerializedRecord> pulsarSourceFunction = new PulsarSourceFunction<>(pulsarSourceInfo.getAdminUrl(), pulsarSourceInfo.getServiceUrl(), pulsarSourceInfo.getTopic(), pulsarSourceInfo.getSubscriptionName(), pulsarSourceInfo.getAuthentication(), new SerializedRecordDeserializationSchema(dataFlowId), config);
pulsarSourceFunction.setRuntimeContext(getRuntimeContext());
pulsarSourceFunction.initializeState(new MultiTenantFunctionInitializationContext(dataFlowId, functionInitializationContext, getRuntimeContext().getExecutionConfig()));
pulsarSourceFunction.open(config);
return pulsarSourceFunction;
}
Aggregations