Example Kafka client connection tools
-------------------------------------

Files:
README.txt
README.heartbeating.txt           Creating the heartbeating topic on the Kafka Server
client.properties                 Working Kafka client configuration
client.properties.ssl             Example SSL Kafka client configuration
client.properties.plaintext       Example simple Kafka client configuration
client.properties.scram           Example SCRAM Kafka client configuration
connect-log4j.properties          Example logj4 properties
connect-log4j.properties.info     Example info logj4 properties
connect-log4j.properties.debug    Example debug logj4 properties

Simple client scripts.
kcat_producer.sh                  Kafka Producer for topic [gateway]
kcat_consumer.sh                  Kafka Consumer for topic [probe]

Directories that need to be populated.
libs                              Apache Kafka libs directory [jars]
ssl                               Apache Kafka servers certificates

o Create the libs directory using the required
  Apache Kafka files from the distribution
https://kafka.apache.org/downloads

Using the Simple Kafka clients:
------------------------------
Create a suitable client.properties based on the Kafka server requirements

cp client.properties.plaintext client.properties
vi client.properties
<update as required>
:wq

o Reading events on a topic [PROBE]

Example usage.
./kcat_consumer.sh kafkahost:9092 heartbeating normal

o Creating events on a topic [GATEWAY]

Example usage.
./kcat_producer.sh kafkahost:9092 heartbeating normal


SSL Kafka Server connection:
---------------------------

o Create the JKS file with required details for the Kafka server

Example webhook SSL files in ssl directory:
localhost.jks  Working JKS store with password netcool
webhook.cert   webhook certificate
webhook.pem    webhook PEM file

Note: These files are used in the Kakfa server

The JKS store can be created using the createWebhookSSL.sh script from
the HTTPS listener FAQ:
https://www.ibm.com/support/pages/node/6563241

The self-sign certifcate can be used for the Kafka Server and probe, 
for testing.

Checking certificate details:

keytool -v -list -keystore localhost.jks -storepass netcool
keytool -list -keystore localhost.jks -storepass netcool

keytool -v -printcert -file webhook.pem
keytool -printcert -file webhook.pem

Note: 
The Apache Kafka server adiministrator needs to use the
localhost.jks in the server for this example test.

o Kafka client configuration settings in client.properties
Configure the client.properties as required for connecting
to the Apache Kafka server
e.g.
cp client.properties.ssl client.properties

o Creating events on the heartbeating topic [GATEWAY]

Command: kcat_producer.sh
Usage: kcat_producer.sh [host]:[port] [topic] [normal|debug]
Provide the Kafka host:port to connect for sending to the topic

Example usage.
./kcat_producer.sh localhost:9093 heartbeating normal

o Reading events on a topic [PROBE]

Command: kcat_consumer.sh
Usage: kcat_consumer.sh [host]:[port] [topic] [normal|debug]
Provide the Kafka host:port to connect for reading the topic

Example usage.
./kcat_consumer.sh localhost:9093 heartbeating normal

Using the connect-log4j.properties file for debugging
-----------------------------------------------------
Specify the debug option instead of normal after setting 
the required options in connect-log4j.properties
e.g.
cp connect-log4j.properties.info connect-log4j.properties

Run the scripts as before setting debug as the third option.
./kcat_consumer.sh localhost:9093 heartbeating debug

All logging is sent to standard out.
Use 'grep' to find specific messages or else save the logging to a file.
'script' can be used to capture the out to a file.
# EOF
