SK SKYVVA Documentation

2. How to use the Agent Kafka Adapter for Producer?

Introduction

Agent Kafka adapter for Producer uses for writing data to Topic, meaning that sends data from Salesforce to Topic in Apache Kafka. To use Kafka for Producer, we need to have a Kafka; then, we need to configure an adapter in the Agent control board.  In this chapter, we will learn how to use the Agent Kafka Adapter for Producer, and we will know how to do outbound with CSV, XML, and JSON file type. Pre-require

1.How to configure a new agent control board.

2. How to check the Caching New Agent control board We can check it for different Object name.

3. How to work with Kafka Outbound Adapter?

Case 1: Create Outbound KAFKA Adapter for CSV format.

  1. We should create different topics to identify various data formats. (This we needed for other use cases, for now, we are using CSV Topic ).

  1. After creating a  topic we can use command below to show all Kafka topic.
  1. Create KAFKA Outbound Adapter for testing with CSV format.

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]CSV file supports Flat mapping and XML/JSON supports hierarchical mapping.[/su_box]

  1. Create a message type using below XML.
[aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] 100001 TestAccountA1 CambodiaA1 PhnomPenhA1 100001 This tutorial will teach you the basics of XML. The tutorial is divided into sections such as XML Basics Advanced XML and XML tools. [/aux_code]
  1. Create Integration.
  2. Create Interface

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]Kafka supports only Synchronous Processing Mode [/su_box]

  1. Consume message send from Salesforce in CSV format
${KAFKA_HOME}/bin/Kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic CSV-Topic
  1. Callout to Kafka server
  1. Here is the result on the server.
  1. The result in message monitoring.
  1. CSV support other separators like the semicolon, tab, and pipe separator.

Case 2: Create Outbound KAFKA Adapter for JSON format.

  1. Create Integration.
  2. Create Interface

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]Kafka supports only Synchronous Processing Mode [/su_box]

${KAFKA_HOME}/bin/Kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic JSON-Topic

  1. Callout to Kafka server

  1. Here is the result on the server.

  1. The result on Message Monitoring.

Case 3: Create Outbound KAFKA Adapter for XML format.

Summary:

Agent Kafka for Producer uses for writing data from Salesforce to the Topic in Kafka, meaning that we use outbound data from Salesforce to Kafka. In Agent Adapter for a producer can work with CSV, XML, and JSON data records, but we need to configure file type in Adapter too. Follow this guide to learning How to use Agent Kafka adapter for consumers (#article/tutorial-v2-41-lightning ).

Open this article in the interactive viewer →