DBZ-5154 Support scripting in Debezium Server

Add Debezium scripting and it's optional JSR 223 dependencies into
server distribution in `lib_opt` directory.

Add these jars into classpath when `ENABLE_DEBEZIUM_SCRIPTING` env.
variable is set to `true`. Otherwise scripting jars are not loaded.
This commit is contained in:
Vojtech Juranek 2022-05-30 15:52:45 +02:00 committed by Jiri Pechanec
parent e463d53449
commit 7ac91c4450
4 changed files with 33 additions and 2 deletions

View File

@ -64,6 +64,16 @@
<groupId>io.debezium</groupId> <groupId>io.debezium</groupId>
<artifactId>debezium-connector-sqlserver</artifactId> <artifactId>debezium-connector-sqlserver</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-scripting</artifactId>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-scripting-languages</artifactId>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency> <dependency>
<groupId>io.debezium</groupId> <groupId>io.debezium</groupId>
<artifactId>debezium-server-core</artifactId> <artifactId>debezium-server-core</artifactId>

View File

@ -24,8 +24,21 @@
<exclude>org.apache.maven:*:*</exclude> <exclude>org.apache.maven:*:*</exclude>
<exclude>log4j:log4j:*</exclude> <exclude>log4j:log4j:*</exclude>
<exclude>ch.qos.reload4j:reload4j</exclude> <exclude>ch.qos.reload4j:reload4j</exclude>
<exclude>io.debezium:debezium-scripting:*</exclude>
<exclude>io.debezium:debezium-scripting-opt-depts:*</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
<dependencySet>
<outputDirectory>${project.parent.artifactId}/lib_opt</outputDirectory>
<unpack>false</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveFiltering>true</useTransitiveFiltering>
<includes>
<include>io.debezium:debezium-scripting:*</include>
<include>io.debezium:debezium-scripting-languages:*</include>
</includes>
</dependencySet>
</dependencySets> </dependencySets>
<fileSets> <fileSets>
<fileSet> <fileSet>

View File

@ -4,4 +4,6 @@ SET JAVA_BINARY=%JAVA_HOME%\bin\java
for %%i in (debezium-server-*runner.jar) do set RUNNER=%%~i for %%i in (debezium-server-*runner.jar) do set RUNNER=%%~i
echo %RUNNER% echo %RUNNER%
call "%JAVA_BINARY%" %DEBEZIUM_OPTS% %JAVA_OPTS% -cp %RUNNER%%PATH_SEP%conf%PATH_SEP%lib\* io.debezium.server.Main SET LIB_PATH=lib\*
IF %ENABLE_DEBEZIUM_SCRIPTING%=="true" LIB_PATH=%LIB_PATH%%PATH_SEP%lib_opt\*
call "%JAVA_BINARY%" %DEBEZIUM_OPTS% %JAVA_OPTS% -cp %RUNNER%%PATH_SEP%conf%PATH_SEP%%LIB_PATH% io.debezium.server.Main

View File

@ -19,4 +19,10 @@ fi
RUNNER=$(ls debezium-server-*runner.jar) RUNNER=$(ls debezium-server-*runner.jar)
exec "$JAVA_BINARY" $DEBEZIUM_OPTS $JAVA_OPTS -cp "$RUNNER"$PATH_SEP"conf"$PATH_SEP"lib/*" io.debezium.server.Main ENABLE_DEBEZIUM_SCRIPTING=${ENABLE_DEBEZIUM_SCRIPTING:-false}
LIB_PATH="lib/*"
if [[ "${ENABLE_DEBEZIUM_SCRIPTING}" == "true" ]]; then
LIB_PATH=$LIB_PATH$PATH_SEP"lib_opt/*"
fi
exec "$JAVA_BINARY" $DEBEZIUM_OPTS $JAVA_OPTS -cp "$RUNNER"$PATH_SEP"conf"$PATH_SEP$LIB_PATH io.debezium.server.Main