Using the AvroJmsWriter sample

The AvroJmsWriter integrated sample application polls records that were read by the Kafka transactionally consistent consumer and publishes them in text format to a JMS topic.

About this task

The Java™ class name for the sample is com.datamirror.ts.kafka.txconsistentconsumer.sampleapplications.AvroJmsWriter.

Procedure

  1. Create a consumer configuration file of type .properties.
    This file contains the connection information for the Kafka broker and the schema registry and has the following entries:
    bootstrap.servers=PLAINTEXT://kafka broker host name:port
    schema.registry.url=HTTP://schema registry host name:port 
    
  2. Create a JMS configuration file with the following entries:
    topicname=jms topic name
    initialcontextfactory=JNDI initial context 
    providerurl=JMS provider URL
    topicconnectionfactory=JMS topic connection factory
  3. Verify that the following libraries are available in your CDC Replication Engine for Kafka installation /lib directory:
    • q-core-5.1.0.jar
    • geronimo-jms_1.1_spec-1.1.1.jar
    • commons-logging-1.1.jar
    • geronimo-j2ee-management_1.0_spec-1.0.jar
  4. Call the application from the /lib directory in your CDC Replication Engine for Kafka installation directory.
    For example:
    $ cd CDC_Kafka_installation_directory/lib
    java -cp "*" class name -cs commit stream topic name -c consumer configuration file name -j JMS configuration file name -d
    Note: To determine the version of the application, use the -v option.