This lab will continue with the MQ StreamQ lab to show how to build MQSOURCE Kafka Connector in IBM Event Streams to synchronize/copy data from IBM MQ Queue to IBM Event Streams Topic.

From the Cloud Pak for Integration Console;
The screen shots are showing this as username student1



In this section you will create the MQSOURCE Connector that will connect your MQ StreamQ from the previous lab to the Kafka topic you just created.

apiVersion: eventstreams.ibm.com/v1beta2
kind: KafkaConnector
metadata:
name: <username>-mq-source-connector
namespace: cp4i-eventstreams
labels:
# The eventstreams.ibm.com/cluster label identifies the KafkaConnect instance
# in which to create this connector. That KafkaConnect instance
# must have the eventstreams.ibm.com/use-connector-resources annotation
# set to true.
eventstreams.ibm.com/cluster: kafka-connect-cluster
spec:
class: com.ibm.eventstreams.connect.mqsource.MQSourceConnector
tasksMax: 1
config:
topic: <username>.LOG.QUEUE
mq.queue.manager: <mqXXstrm>
mq.connection.name.list: <username>-<mqXXstrm>-ibm-mq.<username>.svc(1414)
mq.channel.name: SYSTEM.DEF.SVRCONN
mq.queue: MY.LOG.QUEUE
mq.user.name: dummy
mq.password: dummy
key.converter: org.apache.kafka.connect.storage.StringConverter
value.converter: org.apache.kafka.connect.storage.StringConverter
mq.record.builder: com.ibm.eventstreams.connect.mqsource.builders.DefaultRecordBuilder
mq.message.body.jms: true

From the OpenShift Console;
a) Navigate to Operators > Installed Operators
b) Change project to cp4i-eventstreams
c) Click on “IBM Event Streams” Operator

d) Click on “Kafka Connector” tab

Make sure the student(n)-mq-source-connector is in Ready state
Note This can take up to 6 minutes to complete.
In the terminal window from the previous lab run the test again to put messages on the queue in the ./test directory initiate the testing by running the following command:
The script will then connect to MQ and start sending messages incessantly. Leave this window open to keep sending messages.
sendMessage.sh uses the amqsphac sample application shipped with MQ to put some messages to the application queue APPQ.
The script will not put any messages directly to MY.LOG.QUEUE – the queue manager will do that for us.
After a number of messages have been put, end the script with CTRL-C. Leave the terminal window open.


Close all the applications and terminal windows.
In a terminal navigate to /home/ibmuser/MQonCP4I/streamq/deploy:
cd ~/MQonCP4I/streamq/deploy
Run the cleanup.sh script now to delete the streamq queue manager. You will need to pass the 2 args to this script, your student number and your namespace.
./cleanup.sh
