Skip to content

Commit 6839b24

Browse files
committed
refactoring of code for copying JMS properties, unit test case and log4j - testing in progress
1 parent d4a0f55 commit 6839b24

File tree

18 files changed

+1623
-1573
lines changed

18 files changed

+1623
-1573
lines changed

config/mq-source.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
{
2-
"name": "mq-source",
3-
"config":
4-
{
5-
"connector.class": "com.ibm.eventstreams.connect.mqsource.MQSourceConnector",
6-
"tasks.max": "1",
7-
"topic": "<TOPIC>",
8-
9-
"value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter",
10-
11-
"mq.queue.manager": "<QUEUE_MANAGER>",
12-
"mq.connection.name.list": "<CONNECTION_NAME_LIST>",
13-
"mq.channel.name": "<CHANNEL_NAME>",
14-
"mq.queue": "<QUEUE>",
15-
"mq.record.builder": "com.ibm.eventstreams.connect.mqsource.builders.DefaultRecordBuilder"
16-
}
2+
"name": "mq-source",
3+
"config": {
4+
"connector.class": "com.ibm.eventstreams.connect.mqsource.MQSourceConnector",
5+
"tasks.max": "1",
6+
"topic": "<TOPIC>",
7+
"value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter",
8+
"mq.queue.manager": "<QUEUE_MANAGER>",
9+
"mq.connection.name.list": "<CONNECTION_NAME_LIST>",
10+
"mq.channel.name": "<CHANNEL_NAME>",
11+
"mq.queue": "<QUEUE>",
12+
"mq.record.builder": "com.ibm.eventstreams.connect.mqsource.builders.DefaultRecordBuilder"
13+
}
1714
}

config/mq-source.properties

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,73 +11,53 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
name=mq-source
1615
connector.class=com.ibm.eventstreams.connect.mqsource.MQSourceConnector
17-
1816
# You can increase this for higher throughput, but message ordering will be lost
1917
tasks.max=1
20-
2118
# The name of the MQ queue manager - required
2219
mq.queue.manager=
23-
2420
# The connection mode to connect to MQ - client (default) or bindings - optional
2521
# mq.connection.mode=client
2622
# mq.connection.mode=bindings
27-
2823
# A list of one or more host(port) entries for connecting to the queue manager. Entries are separated with a comma - required (unless using bindings or CCDT)
2924
mq.connection.name.list=
30-
3125
# The name of the server-connection channel - required (unless using bindings or CCDT)
3226
mq.channel.name=
33-
3427
# The name of the source MQ queue - required
3528
mq.queue=
36-
3729
# The user name for authenticating with the queue manager - optional
3830
# mq.user.name=
39-
4031
# The password for authenticating with the queue manager - optional
4132
# mq.password=
42-
4333
# Alternatively can use a ConfigProvider for externalising secrets (see README.md for more details)
4434
# Variable references are of the form ${provider:[path:]key} where the path is optional,
4535
# depending on the ConfigProvider implementation.
4636
# mq.password=${file:/var/run/secret.properties:secret-key}
47-
4837
# The CCDT URL to use to establish a client connection to the queue manager - optional
4938
# mq.ccdt.url=
50-
5139
# The record builders control conversion of data between the messages in MQ and the internal Kafka Connect representation - required
5240
mq.record.builder=com.ibm.eventstreams.connect.mqsource.builders.DefaultRecordBuilder
5341
# mq.record.builder=com.ibm.eventstreams.connect.mqsource.builders.JsonRecordBuilder
54-
5542
# Whether to interpret the message body as a JMS message type (default false) - optional
5643
# mq.message.body.jms=
57-
5844
# The JMS message header to use as the Kafka record key - optional
5945
# Valid values are JMSMessageID, JMSCorrelationID, JMSCorrelationIDAsBytes and JMSDestination
6046
# Don't forget to set key.converter to a compatible converter as described in README.md
6147
# mq.record.builder.key.header=
62-
6348
# The name of the cipher suite for TLS (SSL) connection (default blank, meaning do not use TLS) - optional
6449
# See https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q113220_.htm for valid values
6550
# mq.ssl.cipher.suite=
66-
6751
# The distinguished name pattern of the TLS (SSL) peer - optional
6852
# mq.ssl.peer.name=
69-
7053
# Whether to enable reading of all MQMD fields (default false) - optional
7154
# mq.message.mqmd.read=
72-
7355
# The name of the target Kafka topic - required
7456
topic=
75-
7657
# The converters control conversion of data between the internal Kafka Connect representation and the messages in Kafka.
7758
# key.converter=org.apache.kafka.connect.converters.ByteArrayConverter
7859
# key.converter=org.apache.kafka.connect.storage.StringConverter
7960
# key.converter=org.apache.kafka.connect.json.JsonConverter
80-
8161
value.converter=org.apache.kafka.connect.converters.ByteArrayConverter
8262
# value.converter=org.apache.kafka.connect.storage.StringConverter
8363
# value.converter=org.apache.kafka.connect.json.JsonConverter

kafka-connect.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apps/v1
33
kind: Deployment
44
metadata:
55
name: kafkaconnect-deploy
6-
labels:
6+
labels:
77
app: kafkaconnect-with-mq-source
88
spec:
99
replicas: 1
@@ -44,21 +44,21 @@ spec:
4444
initialDelaySeconds: 20
4545
periodSeconds: 20
4646
ports:
47-
- containerPort: 8083
48-
volumeMounts:
49-
- name: connect-config
50-
mountPath: /opt/kafka/config/connect-distributed.properties
51-
subPath: connect-distributed.properties
52-
- name: connect-log4j
53-
mountPath: /opt/kafka/config/connect-log4j.properties
54-
subPath: connect-log4j.properties
47+
- containerPort: 8083
48+
volumeMounts:
49+
- name: connect-config
50+
mountPath: /opt/kafka/config/connect-distributed.properties
51+
subPath: connect-distributed.properties
52+
- name: connect-log4j
53+
mountPath: /opt/kafka/config/connect-log4j.properties
54+
subPath: connect-log4j.properties
5555
volumes:
56-
- name: connect-config
57-
secret:
58-
secretName: connect-distributed-config
59-
- name: connect-log4j
60-
configMap:
61-
name: connect-log4j-config
56+
- name: connect-config
57+
secret:
58+
secretName: connect-distributed-config
59+
- name: connect-log4j
60+
configMap:
61+
name: connect-log4j-config
6262

6363
---
6464
# Service
@@ -75,4 +75,4 @@ spec:
7575
protocol: TCP
7676
port: 8083
7777
selector:
78-
app: kafkaconnect-with-mq-source
78+
app: kafkaconnect-with-mq-source

pom.xml

Lines changed: 107 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -14,108 +14,116 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
-->
17-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
19-
<modelVersion>4.0.0</modelVersion>
20-
<groupId>com.ibm.eventstreams.connect</groupId>
21-
<artifactId>kafka-connect-mq-source</artifactId>
22-
<packaging>jar</packaging>
23-
<version>1.2.0-SNAPSHOT</version>
24-
<name>kafka-connect-mq-source</name>
17+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
18+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
<groupId>com.ibm.eventstreams.connect</groupId>
21+
<artifactId>kafka-connect-mq-source</artifactId>
22+
<packaging>jar</packaging>
23+
<version>1.2.0-SNAPSHOT</version>
24+
<name>kafka-connect-mq-source</name>
2525
<organization>
26-
<name>IBM Corporation</name>
26+
<name>IBM Corporation</name>
27+
<url>http://ibm.com</url>
28+
</organization>
2729
<url>http://ibm.com</url>
28-
</organization>
29-
<url>http://ibm.com</url>
30-
<description>
31-
A Kafka Connect connector for copying data from IBM MQ into Apache Kafka.
32-
</description>
33-
<licenses>
34-
<license>
35-
<name>Apache License 2.0</name>
36-
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
37-
<distribution>repo</distribution>
38-
</license>
39-
</licenses>
40-
<properties>
41-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
43-
</properties>
44-
<dependencies>
45-
<dependency>
46-
<groupId>org.apache.kafka</groupId>
47-
<artifactId>connect-api</artifactId>
48-
<version>2.3.0</version>
49-
<scope>provided</scope>
50-
</dependency>
51-
<dependency>
52-
<groupId>org.apache.kafka</groupId>
53-
<artifactId>connect-json</artifactId>
54-
<version>2.3.0</version>
55-
<scope>provided</scope>
56-
</dependency>
30+
<description>
31+
A Kafka Connect connector for copying data from IBM MQ into Apache Kafka.
32+
</description>
33+
<licenses>
34+
<license>
35+
<name>Apache License 2.0</name>
36+
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
37+
<distribution>repo</distribution>
38+
</license>
39+
</licenses>
40+
<properties>
41+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
43+
</properties>
44+
<dependencies>
45+
<dependency>
46+
<groupId>org.apache.kafka</groupId>
47+
<artifactId>connect-api</artifactId>
48+
<version>2.3.0</version>
49+
<scope>provided</scope>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.apache.kafka</groupId>
53+
<artifactId>connect-json</artifactId>
54+
<version>2.3.0</version>
55+
<scope>provided</scope>
56+
</dependency>
5757

58-
<dependency>
59-
<groupId>javax.jms</groupId>
60-
<artifactId>javax.jms-api</artifactId>
61-
<version>2.0.1</version>
62-
</dependency>
63-
<dependency>
64-
<groupId>com.ibm.mq</groupId>
65-
<artifactId>com.ibm.mq.allclient</artifactId>
66-
<version>9.1.1.0</version>
67-
</dependency>
58+
<dependency>
59+
<groupId>javax.jms</groupId>
60+
<artifactId>javax.jms-api</artifactId>
61+
<version>2.0.1</version>
62+
</dependency>
63+
<dependency>
64+
<groupId>com.ibm.mq</groupId>
65+
<artifactId>com.ibm.mq.allclient</artifactId>
66+
<version>9.1.1.0</version>
67+
</dependency>
6868

69-
<dependency>
70-
<groupId>junit</groupId>
71-
<artifactId>junit</artifactId>
72-
<version>4.12</version>
73-
<scope>test</scope>
74-
</dependency>
75-
<dependency>
76-
<groupId>org.slf4j</groupId>
77-
<artifactId>slf4j-log4j12</artifactId>
78-
<version>1.7.25</version>
79-
<scope>test</scope>
80-
</dependency>
81-
</dependencies>
69+
<dependency>
70+
<groupId>junit</groupId>
71+
<artifactId>junit</artifactId>
72+
<version>4.12</version>
73+
<scope>test</scope>
74+
</dependency>
75+
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
76+
<dependency>
77+
<groupId>org.mockito</groupId>
78+
<artifactId>mockito-core</artifactId>
79+
<version>3.1.0</version>
80+
<scope>test</scope>
81+
</dependency>
8282

83-
<build>
84-
<plugins>
85-
<plugin>
86-
<artifactId>maven-compiler-plugin</artifactId>
87-
<version>3.1</version>
88-
<configuration>
89-
<source>1.8</source>
90-
<target>1.8</target>
91-
</configuration>
92-
</plugin>
93-
<plugin>
94-
<artifactId>maven-surefire-plugin</artifactId>
95-
<version>3.0.0-M1</version>
96-
<configuration>
97-
<systemPropertyVariables>
98-
<connectorVersion>${project.version}</connectorVersion>
99-
</systemPropertyVariables>
100-
</configuration>
101-
</plugin>
102-
<plugin>
103-
<artifactId>maven-assembly-plugin</artifactId>
104-
<version>3.1.1</version>
105-
<executions>
106-
<execution>
107-
<phase>package</phase>
108-
<goals>
109-
<goal>single</goal>
110-
</goals>
111-
</execution>
112-
</executions>
113-
<configuration>
114-
<descriptors>
115-
<descriptor>src/assembly/package.xml</descriptor>
116-
</descriptors>
117-
</configuration>
118-
</plugin>
119-
</plugins>
120-
</build>
83+
<dependency>
84+
<groupId>org.slf4j</groupId>
85+
<artifactId>slf4j-log4j12</artifactId>
86+
<version>1.7.25</version>
87+
<scope>test</scope>
88+
</dependency>
89+
</dependencies>
90+
91+
<build>
92+
<plugins>
93+
<plugin>
94+
<artifactId>maven-compiler-plugin</artifactId>
95+
<version>3.1</version>
96+
<configuration>
97+
<source>1.8</source>
98+
<target>1.8</target>
99+
</configuration>
100+
</plugin>
101+
<plugin>
102+
<artifactId>maven-surefire-plugin</artifactId>
103+
<version>3.0.0-M1</version>
104+
<configuration>
105+
<systemPropertyVariables>
106+
<connectorVersion>${project.version}</connectorVersion>
107+
</systemPropertyVariables>
108+
</configuration>
109+
</plugin>
110+
<plugin>
111+
<artifactId>maven-assembly-plugin</artifactId>
112+
<version>3.1.1</version>
113+
<executions>
114+
<execution>
115+
<phase>package</phase>
116+
<goals>
117+
<goal>single</goal>
118+
</goals>
119+
</execution>
120+
</executions>
121+
<configuration>
122+
<descriptors>
123+
<descriptor>src/assembly/package.xml</descriptor>
124+
</descriptors>
125+
</configuration>
126+
</plugin>
127+
</plugins>
128+
</build>
121129
</project>

0 commit comments

Comments
 (0)