File tree Expand file tree Collapse file tree
pulsar-io/kinesis/src/main/java/org/apache/pulsar/io/kinesis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,10 +114,25 @@ public static KinesisSinkConfig load(String yamlFile) throws IOException {
114114 defaultValue = "" ,
115115 help = "Path to the native Amazon Kinesis Producer Library (KPL) binary.\n "
116116 + "Only use this setting if you want to use a custom build of the native code.\n "
117- + "This setting can also be set with the environment variable `PULSAR_IO_KINESIS_KPL_PATH`.\n "
117+ + "This setting can also be set with the environment variable `PULSAR_IO_KINESIS_KPL_1_0_PATH`"
118+ + "or `PULSAR_IO_KINESIS_KPL_PATH`.\n "
118119 + "If not set, the Kinesis sink will use the built-in native executable."
119120 )
120- private String nativeExecutable = System .getenv ("PULSAR_IO_KINESIS_KPL_PATH" );
121+ private String nativeExecutable = resolveDefaultKinesisProducerLibraryPath ();
122+
123+ private static String resolveDefaultKinesisProducerLibraryPath () {
124+ // Prefer PULSAR_IO_KINESIS_KPL_1_0_PATH environment variable over PULSAR_IO_KINESIS_KPL_PATH.
125+ // This setting supports building a Pulsar Functions base image that is used to run different Pulsar IO Kinesis
126+ // sink versions. The older versions of Pulsar IO Kinesis sink can continue to use the binary configured with
127+ // PULSAR_IO_KINESIS_KPL_PATH, pointing to a 0.15.12 native executable. The newer versions of Pulsar IO Kinesis
128+ // sink can use the binary configured with PULSAR_IO_KINESIS_KPL_1_0_PATH, pointing to a 1.0.4
129+ // native executable.
130+ String kplPath = System .getenv ("PULSAR_IO_KINESIS_KPL_1_0_PATH" );
131+ if (isNotBlank (kplPath )) {
132+ return kplPath ;
133+ }
134+ return System .getenv ("PULSAR_IO_KINESIS_KPL_PATH" );
135+ }
121136
122137 public enum MessageFormat {
123138 /**
You can’t perform that action at this time.
0 commit comments