Unit Testing Event Publication and Subscription

After you configure Kafka, you need to do preliminary tests to check if the configurations are correct. Sidecar APIs implement consumer and producer application, but Kafka installations also come with simple Consumer and Producer console (command line/shell) applications. You can configure consumer.properties and producer.properties file in Kafka installation, start necessary topics, send a request in the producer console and verify that it appears in the consumer console apps. These tests can ensure that various configurations (for example, SSL configurations) in Kafka and Siebel CRM are correct.

To Test Kafka producer and consumer console test apps

  1. Update the Kafka consumer.properties and producer.properties files for testing communication over SSL, as follows:
    security.protocol=SSL
    ssl.keystore.location=<Fully qualified Siebel Keystore file location> ssl.keystore.password=<pwd value>
    ssl.truststore.location=< Fully qualified Siebel Truststore file location> ssl.truststore.password=<pwd value>
    ssl.key.password=<pwd value>
    
  2. Start the Kafka consumer console app from the Kafka bin directory. For example:
    kafka-console-consumer.bat --topic <name of topic> --bootstrap-server
    <fully qualified Kafka server hostname>:9093 --consumer.config "D:\kafka\config\consumer.properties"
    
  3. Start the Kafka producer console app from the Kafka bin directory. For example:
    kafka-console-producer.bat --topic <name of topic> --bootstrap-server
    <fully qualified Kafka server hostname>:9093 --producer.config "D:\kafka\config\producer.properties"
    
  4. Test the communication between the producer and consumer by sending a sample JSON message from the producer and confirming that the consumer receives it. Ensure that the producer and consumer are on the same topic. For example:
    Sample command to send a message from the producer:
    C:\kafka3\bin\windows>kafka-console-producer.bat --topic crm --bootstrap-server "phoenix680317.appsdev.fusionappsdphx1.oraclevcn.com":9095 --producer.config "C:\kafka3\config\consumer.properties"
    >{"name":"helloworld”}
    
    Sample command to verify the message received by the consumer:
    C:\kafka3\bin\windows>kafka-console-consumer.bat --topic crm --bootstrap-server "phoenix680317.appsdev.fusionappsdphx1.oraclevcn.com":9095 --consumer.config "C:\kafka3\config\consumer.properties"
    {"name":"helloworld”}
    

    In the above example, the JSON payload sent from the producer to the crm topic must be displayed in the consumer console. This confirms that the Kafka configuration and setup is correct.

To configure SASL/OAUTHBEARER with Event Publication and Subscription for Kafka clients

  1. Update the following properties in the producer.properties and consumer.properties files:
    security.protocol=SASL_PLAINTEXT
    sasl.mechanism=OAUTHBEARER
     
    sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
    clientId=<OAuth client ID> \
    clientSecret=<OAuth client secret> \
    scope="abcall";
     
    sasl.oauthbearer.token.endpoint.url=<OAuth token URL>
    sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginCallbackHandler
    
  2. Configure the JVM parameters using the truststore file and its password at the command prompt where the Kafka client will be started, as follows:

    On Windows:

    set KAFKA_OPTS=-Djavax.net.ssl.trustStore=oauth2-openssl-truststore.jks -
    Djavax.net.ssl.trustStorePassword=changeit