Search in sources :

Example 1 with MultiTenantFunctionInitializationContext

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;
}
Also used : SerializedRecord(org.apache.inlong.sort.flink.SerializedRecord) Configuration(org.apache.inlong.sort.configuration.Configuration) PulsarSourceFunction(org.apache.inlong.sort.flink.pulsar.PulsarSourceFunction) MultiTenantFunctionInitializationContext(org.apache.inlong.sort.flink.multitenant.MultiTenantFunctionInitializationContext)

Aggregations

Configuration (org.apache.inlong.sort.configuration.Configuration)1 SerializedRecord (org.apache.inlong.sort.flink.SerializedRecord)1 MultiTenantFunctionInitializationContext (org.apache.inlong.sort.flink.multitenant.MultiTenantFunctionInitializationContext)1 PulsarSourceFunction (org.apache.inlong.sort.flink.pulsar.PulsarSourceFunction)1