Skip to content

Commit 0684079

Browse files
Andrew SchofieldAndrew Schofield
Andrew Schofield
authored and
Andrew Schofield
committed
Handle ClassCastException and update version
1 parent 4680e2d commit 0684079

File tree

9 files changed

+36
-36
lines changed

9 files changed

+36
-36
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ COPY --chown=esuser:esgroup --from=builder /opt/kafka/libs/ /opt/kafka/libs/
1111
COPY --chown=esuser:esgroup --from=builder /opt/kafka/config/connect-distributed.properties /opt/kafka/config/
1212
COPY --chown=esuser:esgroup --from=builder /opt/kafka/config/connect-log4j.properties /opt/kafka/config/
1313
RUN mkdir /opt/kafka/logs && chown esuser:esgroup /opt/kafka/logs
14-
COPY --chown=esuser:esgroup target/kafka-connect-mq-source-1.1.0-jar-with-dependencies.jar /opt/kafka/libs/
14+
COPY --chown=esuser:esgroup target/kafka-connect-mq-source-1.1.1-jar-with-dependencies.jar /opt/kafka/libs/
1515

1616
WORKDIR /opt/kafka
1717

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ You need an instance of Kafka Connect running in distributed mode. The Kafka dis
7676

7777
To start the MQ connector, you can use `config/mq-source.json` in this repository after replacing all placeholders and use a command like this:
7878

79-
```shell
79+
``` shell
8080
curl -X POST -H "Content-Type: application/json" http://localhost:8083/connectors \
8181
--data "@./config/mq-source.json"
8282
```
@@ -103,7 +103,7 @@ The deployment assumes the existence of a Secret called `connect-distributed-con
103103
Create Secret for Kafka Connect configuration:
104104
1. `cp kafka/config/connect-distributed.properties connect-distributed.properties.orig`
105105
1. `sed '/^#/d;/^[[:space:]]*$/d' < connect-distributed.properties.orig > connect-distributed.properties`
106-
1. `kubectl -n <namespace> create secret connect-distributed-config --from-file=connect-distributed.properties`
106+
1. `kubectl -n <namespace> create secret generic connect-distributed-config --from-file=connect-distributed.properties`
107107

108108
Create ConfigMap for Kafka Connect Log4j configuration:
109109
1. `cp kafka/config/connect-log4j.properties connect-log4j.properties.orig`

UsingMQwithKafkaConnect.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,61 +33,60 @@ It is assumed that you have installed MQ, you're logged in as a user authorized
3333
crtmqm -p 1414 MYQM
3434
```
3535

36-
1. Start the queue manager:
36+
2. Start the queue manager:
3737
``` shell
3838
strmqm MYQM
3939
```
4040

41-
1. Start the `runmqsc` tool to configure the queue manager:
41+
3. Start the `runmqsc` tool to configure the queue manager:
4242
``` shell
4343
runmqsc MYQM
4444
```
4545

46-
1. In `runmqsc`, create a server-connection channel:
46+
4. In `runmqsc`, create a server-connection channel:
4747
```
4848
DEFINE CHANNEL(MYSVRCONN) CHLTYPE(SVRCONN)
4949
```
5050

51-
1. Set the channel authentication rules to accept connections requiring userid and password:
51+
5. Set the channel authentication rules to accept connections requiring userid and password:
5252
```
5353
SET CHLAUTH(MYSVRCONN) TYPE(BLOCKUSER) USERLIST('nobody')
5454
SET CHLAUTH('*') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS)
5555
SET CHLAUTH(MYSVRCONN) TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) CHCKCLNT(REQUIRED)
5656
```
5757

58-
1. Set the identity of the client connections based on the supplied context, the user ID:
58+
6. Set the identity of the client connections based on the supplied context, the user ID:
5959
```
6060
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) ADOPTCTX(YES)
6161
```
6262

63-
1. Refresh the connection authentication information:
63+
7. Refresh the connection authentication information:
6464
```
6565
REFRESH SECURITY TYPE(CONNAUTH)
6666
```
6767

68-
1. Create a queue for the connector to use:
68+
8. Create a queue for the connector to use:
6969
```
7070
DEFINE QLOCAL(MYQSOURCE)
7171
```
7272

73-
1. Authorize `alice` to connect to and inquire the queue manager:
73+
9. Authorize `alice` to connect to and inquire the queue manager:
7474
```
7575
SET AUTHREC OBJTYPE(QMGR) PRINCIPAL('alice') AUTHADD(CONNECT,INQ)
7676
```
7777

78-
1. Finally authorize `alice` to use the queue:
78+
10. Finally authorize `alice` to use the queue:
7979
```
8080
SET AUTHREC PROFILE(MYQSOURCE) OBJTYPE(QUEUE) PRINCIPAL('alice') AUTHADD(ALLMQI)
8181
```
8282

83-
1. End `runmqsc`:
83+
11. End `runmqsc`:
8484
```
8585
END
8686
```
8787

8888
The queue manager is now ready to accept connection from Kafka Connect connectors.
8989

90-
9190
### Set up Apache Kafka
9291
These instructions assume you have Apache Kafka downloaded and running locally. See the [Apache Kafka quickstart guide](https://kafka.apache.org/quickstart) for more details.
9392

@@ -96,11 +95,11 @@ These instructions assume you have Apache Kafka downloaded and running locally.
9695
bin/zookeeper-server-start.sh config/zookeeper.properties
9796
```
9897

99-
1. In another terminal, start a Kafka server:
98+
2. In another terminal, start a Kafka server:
10099
``` shell
101100
bin/kafka-server-start.sh config/server.properties
102101
```
103-
1. Create a topic called `TSOURCE` for the connector to send events to:
102+
3. Create a topic called `TSOURCE` for the connector to send events to:
104103
``` shell
105104
bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic TSOURCE --partitions 1 --replication-factor 1
106105
```
@@ -133,18 +132,18 @@ Configure and run the connector:
133132
cp config/mq-source.properties ~
134133
```
135134

136-
1. Edit the following properties in the `~/mq-source.properties` file to match the configuration so far:
137-
```
138-
mq.queue.manager=MYQM
139-
mq.connection.name.list=localhost(1414)
140-
mq.channel.name=MYSVRCONN
141-
mq.queue=MYQSOURCE
142-
mq.user.name=alice
143-
mq.password=passw0rd
144-
topic=TSOURCE
145-
```
135+
2. Edit the following properties in the `~/mq-source.properties` file to match the configuration so far:
136+
```
137+
topic=TSOURCE
138+
mq.queue.manager=MYQM
139+
mq.connection.name.list=localhost(1414)
140+
mq.channel.name=MYSVRCONN
141+
mq.queue=MYQSOURCE
142+
mq.user.name=alice
143+
mq.password=passw0rd
144+
```
146145

147-
1. Change directory to the Kafka root directory. Start the connector worker replacing `<connector-root-directory>` and `<version>` with your directory and the connector version:
146+
3. Change directory to the Kafka root directory. Start the connector worker replacing `<connector-root-directory>` and `<version>` with your directory and the connector version:
148147
``` shell
149148
CLASSPATH=<connector-root-directory>/target/kafka-connect-mq-source-<version>-jar-with-dependencies.jar bin/connect-standalone.sh config/connect-standalone.properties ~/mq-source.properties
150149
```

config/mq-source.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "mq-source",
3-
"config":{
3+
"config":
4+
{
45
"connector.class": "com.ibm.eventstreams.connect.mqsource.MQSourceConnector",
56
"tasks.max": "1",
67
"topic": "<TOPIC>",
7-
8+
89
"value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter",
910

1011
"mq.queue.manager": "<QUEUE_MANAGER>",

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<groupId>com.ibm.eventstreams.connect</groupId>
2121
<artifactId>kafka-connect-mq-source</artifactId>
2222
<packaging>jar</packaging>
23-
<version>1.1.0</version>
23+
<version>1.1.1</version>
2424
<name>kafka-connect-mq-source</name>
2525
<organization>
2626
<name>IBM Corporation</name>
@@ -45,13 +45,13 @@
4545
<dependency>
4646
<groupId>org.apache.kafka</groupId>
4747
<artifactId>connect-api</artifactId>
48-
<version>2.0.0</version>
48+
<version>2.3.0</version>
4949
<scope>provided</scope>
5050
</dependency>
5151
<dependency>
5252
<groupId>org.apache.kafka</groupId>
5353
<artifactId>connect-json</artifactId>
54-
<version>2.0.0</version>
54+
<version>2.3.0</version>
5555
<scope>provided</scope>
5656
</dependency>
5757

src/main/java/com/ibm/eventstreams/connect/mqsource/JMSReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ else if (connectionMode.equals(MQSourceConnector.CONFIG_VALUE_MQ_CONNECTION_MODE
176176
builder = c.newInstance();
177177
builder.configure(props);
178178
}
179-
catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NullPointerException exc) {
179+
catch (ClassNotFoundException | ClassCastException | IllegalAccessException | InstantiationException | NullPointerException exc) {
180180
log.error("Could not instantiate message builder {}", builderClass);
181181
throw new ConnectException("Could not instantiate message builder", exc);
182182
}

src/main/java/com/ibm/eventstreams/connect/mqsource/MQSourceConnector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public class MQSourceConnector extends SourceConnector {
107107
public static final String CONFIG_DOCUMENTATION_TOPIC = "The name of the target Kafka topic.";
108108
public static final String CONFIG_DISPLAY_TOPIC = "Target Kafka topic";
109109

110-
public static String VERSION = "1.1.0";
110+
public static String VERSION = "1.1.1";
111111

112112
private Map<String, String> configProps;
113113

src/test/java/com/ibm/eventstreams/connect/mqsource/MQSourceConnectorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2017 IBM Corporation
2+
* Copyright 2017, 2018, 2019 IBM Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/test/resources/log4j.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 IBM Corporation
2+
# Copyright 2017, 2019, 2019 IBM Corporation
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)