Skip to content

Commit 337a351

Browse files
authored
Merge pull request #38 from linny0608/updateDependencyVer
Enhance Performance, Update Version, and Dependencies
2 parents c097b30 + eeb7ade commit 337a351

15 files changed

+929
-131
lines changed

connectors/THIRD_PARTY_LICENSE.txt

Lines changed: 819 additions & 42 deletions
Large diffs are not rendered by default.

connectors/pom.xml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
<maven.compiler.target>${java.version}</maven.compiler.target>
4747
<maven.compiler.source>${java.version}</maven.compiler.source>
4848
<java.version>11</java.version>
49-
<logback.version>1.3.0-alpha13</logback.version>
49+
<logback.version>1.4.14</logback.version>
5050
<oracle-db-messaging.version>23.2.0.0</oracle-db-messaging.version>
5151
<oracle-jdbc.version>23.2.0.0</oracle-jdbc.version>
5252
<oracle.database.security.version>21.9.0.0</oracle.database.security.version>
5353
<jms.version>2.0.1</jms.version>
54-
<kafka.version>3.2.0</kafka.version>
54+
<kafka.version>3.6.1</kafka.version>
5555
</properties>
5656

5757
<dependencies>
@@ -68,13 +68,6 @@
6868
<version>${kafka.version}</version>
6969
<scope>provided</scope>
7070
</dependency>
71-
<!-- https://mvnrepository.com/artifact/org.apache.kafka/connect-runtime -->
72-
<dependency>
73-
<groupId>org.apache.kafka</groupId>
74-
<artifactId>connect-runtime</artifactId>
75-
<version>3.2.0</version>
76-
</dependency>
77-
7871
<!-- Oracle Database Dependencies -->
7972
<dependency>
8073
<groupId>com.oracle.database.jdbc</groupId>
@@ -111,11 +104,6 @@
111104
<artifactId>jta</artifactId>
112105
<version>1.1</version>
113106
</dependency>
114-
<dependency>
115-
<groupId>ch.qos.logback</groupId>
116-
<artifactId>logback-classic</artifactId>
117-
<version>${logback.version}</version>
118-
</dependency>
119107
</dependencies>
120108

121109
<build>

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/common/utils/AppInfoParser.java

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

@@ -24,14 +24,10 @@
2424

2525
package oracle.jdbc.txeventq.kafka.connect.common.utils;
2626

27-
import org.apache.kafka.common.MetricName;
28-
import org.apache.kafka.common.metrics.Gauge;
29-
import org.apache.kafka.common.metrics.MetricConfig;
30-
import org.apache.kafka.common.metrics.Metrics;
31-
import org.apache.kafka.common.utils.Sanitizer;
32-
33-
import org.slf4j.Logger;
34-
import org.slf4j.LoggerFactory;
27+
import java.io.IOException;
28+
import java.io.InputStream;
29+
import java.lang.management.ManagementFactory;
30+
import java.util.Properties;
3531

3632
import javax.management.InstanceAlreadyExistsException;
3733
import javax.management.InstanceNotFoundException;
@@ -41,10 +37,13 @@
4137
import javax.management.NotCompliantMBeanException;
4238
import javax.management.ObjectName;
4339

44-
import java.io.IOException;
45-
import java.io.InputStream;
46-
import java.lang.management.ManagementFactory;
47-
import java.util.Properties;
40+
import org.apache.kafka.common.MetricName;
41+
import org.apache.kafka.common.metrics.Gauge;
42+
import org.apache.kafka.common.metrics.MetricConfig;
43+
import org.apache.kafka.common.metrics.Metrics;
44+
import org.apache.kafka.common.utils.Sanitizer;
45+
import org.slf4j.Logger;
46+
import org.slf4j.LoggerFactory;
4847

4948
public class AppInfoParser {
5049
private static final Logger log = LoggerFactory.getLogger(AppInfoParser.class);
@@ -55,13 +54,13 @@ public class AppInfoParser {
5554

5655
static {
5756
Properties props = new Properties();
58-
try (InputStream resourceStream = AppInfoParser.class.getResourceAsStream("/kafka-connect-oracle-version.properties")) {
57+
try (InputStream resourceStream = AppInfoParser.class
58+
.getResourceAsStream("/kafka-connect-oracle-version.properties")) {
5959
props.load(resourceStream);
6060
} catch (IOException e) {
6161
log.warn("Error while loading kafka-connect-oracle-version.properties.");
6262
}
6363

64-
6564
NAME = props.getProperty("name", "unknown").trim();
6665
VERSION = props.getProperty("version", "unknown").trim();
6766
COMMIT_ID = props.getProperty("commitId", "unknown").trim();
@@ -71,16 +70,19 @@ public class AppInfoParser {
7170
public static String getName() {
7271
return NAME;
7372
}
73+
7474
public static String getVersion() {
7575
return VERSION;
7676
}
77+
7778
public static String getCommitId() {
7879
return COMMIT_ID;
7980
}
8081

8182
public static synchronized void registerAppInfo(String prefix, String id, Metrics metrics) {
8283
try {
83-
ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + Sanitizer.jmxSanitize(id));
84+
ObjectName name = new ObjectName(
85+
prefix + ":type=app-info,id=" + Sanitizer.jmxSanitize(id));
8486
AppInfoParser.AppInfo mBean = new AppInfoParser.AppInfo();
8587
ManagementFactory.getPlatformMBeanServer().registerMBean(mBean, name);
8688
registerMetrics(metrics); // prefix will be added later by JmxReporter
@@ -98,7 +100,8 @@ public static synchronized void registerAppInfo(String prefix, String id, Metric
98100
public static synchronized void unregisterAppInfo(String prefix, String id, Metrics metrics) {
99101
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
100102
try {
101-
ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + Sanitizer.jmxSanitize(id));
103+
ObjectName name = new ObjectName(
104+
prefix + ":type=app-info,id=" + Sanitizer.jmxSanitize(id));
102105
if (server.isRegistered(name))
103106
server.unregisterMBean(name);
104107

@@ -118,8 +121,10 @@ private static MetricName metricName(Metrics metrics, String name) {
118121

119122
private static void registerMetrics(Metrics metrics) {
120123
if (metrics != null) {
121-
metrics.addMetric(metricName(metrics, "version"), new AppInfoParser.ImmutableValue<>(VERSION));
122-
metrics.addMetric(metricName(metrics, "commit-id"), new AppInfoParser.ImmutableValue<>(COMMIT_ID));
124+
metrics.addMetric(metricName(metrics, "version"),
125+
new AppInfoParser.ImmutableValue<>(VERSION));
126+
metrics.addMetric(metricName(metrics, "commit-id"),
127+
new AppInfoParser.ImmutableValue<>(COMMIT_ID));
123128
}
124129
}
125130

@@ -132,14 +137,15 @@ private static void unregisterMetrics(Metrics metrics) {
132137

133138
public interface AppInfoMBean {
134139
public String getVersion();
140+
135141
public String getCommitId();
136142
}
137143

138144
public static class AppInfo implements AppInfoParser.AppInfoMBean {
139145

140146
public AppInfo() {
141147
}
142-
148+
143149
@Override
144150
public String getVersion() {
145151
return AppInfoParser.getVersion();

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/common/utils/Constants.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*
2+
** Kafka Connect for TxEventQ.
3+
**
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
6+
*/
7+
8+
/*
9+
* Licensed to the Apache Software Foundation (ASF) under one or more
10+
* contributor license agreements. See the NOTICE file distributed with
11+
* this work for additional information regarding copyright ownership.
12+
* The ASF licenses this file to You under the Apache License, Version 2.0
13+
* (the "License"); you may not use this file except in compliance with
14+
* the License. You may obtain a copy of the License at
15+
*
16+
* http://www.apache.org/licenses/LICENSE-2.0
17+
*
18+
* Unless required by applicable law or agreed to in writing, software
19+
* distributed under the License is distributed on an "AS IS" BASIS,
20+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
* See the License for the specific language governing permissions and
22+
* limitations under the License.
23+
*/
24+
125
package oracle.jdbc.txeventq.kafka.connect.common.utils;
226

327
/**

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/sink/TxEventQSinkConnector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/sink/task/TxEventQSinkTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/sink/utils/TxEventQProducer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/sink/utils/TxEventQSinkConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/source/TxEventQSourceConnector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/source/task/TxEventQSourceTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/source/utils/TxEventQConnectorConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

connectors/src/main/java/oracle/jdbc/txeventq/kafka/connect/source/utils/TxEventQConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
** Kafka Connect for TxEventQ version 1.0.
2+
** Kafka Connect for TxEventQ.
33
**
4-
** Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
** Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
*/
77

@@ -24,14 +24,15 @@
2424

2525
package oracle.jdbc.txeventq.kafka.connect.source.utils;
2626

27+
import java.util.Map;
28+
2729
import org.apache.kafka.connect.data.Schema;
2830
import org.apache.kafka.connect.source.SourceRecord;
2931

30-
import java.util.Map;
31-
3232
/**
33-
* A message is the unit that is enqueued or dequeued. An TEQ Message object holds both its content, or payload, and its properties.
34-
* This class provides methods to get and set message properties and the payload.
33+
* A message is the unit that is enqueued or dequeued. An TEQ Message object holds both its content,
34+
* or payload, and its properties. This class provides methods to get and set message properties and
35+
* the payload.
3536
*
3637
* @param <T>
3738
*/
@@ -42,52 +43,54 @@ public class TxEventQSourceRecord extends SourceRecord {
4243
private byte[] messageId = new byte[0];
4344

4445
public enum PayloadType {
45-
RAW, JSON, JMS
46+
RAW, JSON, JMS
4647
}
4748

4849
private final PayloadType payloadType;
4950

50-
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset, String topic,
51-
Integer partition, Schema valueSchema, Object value, PayloadType type, byte[] msgId) {
52-
super(sourcePartition, sourceOffset, topic, partition, valueSchema, value);
53-
this.payloadType = type;
54-
this.messageId = msgId;
51+
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset,
52+
String topic, Integer partition, Schema valueSchema, Object value, PayloadType type,
53+
byte[] msgId) {
54+
super(sourcePartition, sourceOffset, topic, partition, valueSchema, value);
55+
this.payloadType = type;
56+
this.messageId = msgId;
5557
}
5658

57-
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset, String topic,
58-
Integer partition, Schema keySchema, java.lang.Object key, Schema valueSchema, Object value,
59-
PayloadType type, byte[] msgId) {
60-
super(sourcePartition, sourceOffset, topic, partition, keySchema, key, valueSchema, value);
61-
this.payloadType = type;
62-
this.messageId = msgId;
59+
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset,
60+
String topic, Integer partition, Schema keySchema, java.lang.Object key,
61+
Schema valueSchema, Object value, PayloadType type, byte[] msgId) {
62+
super(sourcePartition, sourceOffset, topic, partition, keySchema, key, valueSchema, value);
63+
this.payloadType = type;
64+
this.messageId = msgId;
6365
}
6466

65-
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset, String topic,
66-
Schema valueSchema, Object value, PayloadType type, byte[] msgId) {
67-
super(sourcePartition, sourceOffset, topic, valueSchema, value);
68-
this.payloadType = type;
69-
this.messageId = msgId;
67+
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset,
68+
String topic, Schema valueSchema, Object value, PayloadType type, byte[] msgId) {
69+
super(sourcePartition, sourceOffset, topic, valueSchema, value);
70+
this.payloadType = type;
71+
this.messageId = msgId;
7072
}
7173

72-
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset, String topic,
73-
Schema keySchema, java.lang.Object key, Schema valueSchema, Object value, PayloadType type, byte[] msgId) {
74-
super(sourcePartition, sourceOffset, topic, keySchema, key, valueSchema, value);
75-
this.payloadType = type;
76-
this.messageId = msgId;
74+
public TxEventQSourceRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset,
75+
String topic, Schema keySchema, java.lang.Object key, Schema valueSchema, Object value,
76+
PayloadType type, byte[] msgId) {
77+
super(sourcePartition, sourceOffset, topic, keySchema, key, valueSchema, value);
78+
this.payloadType = type;
79+
this.messageId = msgId;
7780
}
7881

7982
public PayloadType getPayloadType() {
80-
return payloadType;
83+
return payloadType;
8184
}
8285

8386
public String getMessageId() {
84-
return byteArrayToHex(messageId);
87+
return byteArrayToHex(messageId);
8588
}
8689

8790
private static String byteArrayToHex(byte[] a) {
88-
StringBuilder sb = new StringBuilder(a.length * 2);
89-
for (byte b : a)
90-
sb.append(String.format("%02x", b));
91-
return sb.toString();
91+
StringBuilder sb = new StringBuilder(a.length * 2);
92+
for (byte b : a)
93+
sb.append(String.format("%02x", b));
94+
return sb.toString();
9295
}
9396
}

connectors/src/main/resources/connect-txeventq-sink.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
2-
## Kafka Connect for TxEventQ version 1.0.
2+
## Kafka Connect for TxEventQ.
33
##
4-
## Copyright (c) 2019, 2022 Oracle and/or its affiliates.
4+
## Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
66
#
77

0 commit comments

Comments
 (0)