SK SKYVVA Documentation

2. How to use Agent Pulsar adapter for Consumer?

Learning Objectives:- This unit describes:-

Introduction:

In this tutorial, we will learn how Agent Pulsar adapter works for Consumers. In simple words, an Agent pulsar adapter for Consumer means Inbound Pulsar Adapter. We use Inbound Pulsar Adapter when somebody pushes the topic into a topic customer on the Kafka side, then we are consuming. We have an event-driven listener which is camel consumer. We don't need a scheduler. We can consume immediately. This is the Inbound process because we are receiving data here. It plays the role of the consumer. So now we are going to check the use cases for inbound Pulsar Adapter i.e, for consumers. To configure, firstly we need to learn and follow some steps: 1.How to configure a new agent control board.

CASE 1: Use Case for file type CSV

2. Create Adapter:

3. Configure Interface page:

4. Start the route:

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]First we need to add the Adapter in interface section. Otherwise we will get an error while starting route.[/su_box] 5. Do Mapping:

6. Callout to Pulsar Server: [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] Command: (You need to create CSV file and also need to put **File on agent-tools-server) For example: /home/ec2-user/paras_agent_pulsar/Inbound/Pulsar_CSV_Inbound.csv and execute the below command on Ec2 new agent-tools-server command prompt.** pulsar-client produce non-persistent://vip/skyvva/InboundCSVTopic -f /home/ec2-user/paras_agent_pulsar/Inbound/Pulsar_CSV_Inbound.csv OR When Is Persistent checkbox is true inside adapter property then you need to use Persistent command: pulsar-client produce persistent://vip/skyvva/InboundCSVTopic -f /home/ec2-user/paras_agent_pulsar/Inbound/Pulsar_CSV_Inbound.csv [/aux_code]

7. Message Monitoring:

CASE 2: Use Case for file type XML

1. We need to do Agent control board configuration as we did in CSV. Don't need to create new. 2. Create Adapter:

3. Configure Interface page:

4. Start the route:

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]First we need to add the Adapter in interface section. Otherwise we will get an error while starting route.[/su_box] 5. Do Mapping:

6. Callout to Pulsar Server: [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] Callout: (You need to execute below command in Ec2 new Agent-tools-server command prompt and also need to past XML file in one line. 1st Way: Sample Data- In the Format we need to add namespace in the root. Testing Pulsar InBound Account1 Testing Pulsar InBound Account1 Description. Testing Pulsar InBound Contact1 15.00 K_I_Asset001 Testing Pulsar InBound Asset1 Testing Pulsar InBound Contact2 15.00 K_I_Asset002 Testing Pulsar InBound Asset2 Testing Pulsar InBound Account2 Testing Pulsar InBound Account2 Description. Testing Pulsar InBound Contact3 15.00 K_I_Asset003 Testing Pulsar InBound Asset3 Testing Pulsar InBound Contact4 15.00 K_I_Asset004 Testing Pulsar InBound Asset4 2nd Way: Upload XML File on /home/ec2-user/paras_agent_pulsar/Inbound/Pulsar_XML_Inbound.xml Command: pulsar-client produce non-persistent://vip/skyvva/InboundXMLTopic -f /home/ec2-user/paras_agent_pulsar/Inbound/Pulsar_XML_Inbound.xml [/aux_code]

7. Message Monitoring:

CASE 3: Use Case for file type JSON

1. We need to do Agent control board configuration as we did in CSV. Don't need to create new. 2. Create Adapter:

3. Configure Interface page:

4. Start the route:

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]First we need to add the Adapter in interface section. Otherwise we will get an error while starting route.[/su_box] 5. Do Mapping:

6. Callout to Pulsar Server: [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] Callout: (You need to execute below command in Ec2 new Agent-tools-server command prompt. 1st Way: Sample Data- { "MyAccount":{ "Name":"Testing Pulsar InBound Account1", "Description":"Testing Pulsar InBound Account1 Description", "MyContact":{ "FirstName":"Testing", "LastName":"Pulsar InBound Contact1", "MyAsset":{ "Quantity":15.00, "SerialNumber":"K_I_Asset001", "Asset_Name":"Testing Pulsar InBound Asset1" } } } } 2nd Way: Upload JSON File on /home/ec2-user/paras_agent_pulsar/Inbound/Pulsar_JSON_Inbound.json Command: pulsar-client produce non-persistent://vip/skyvva/InboundJSONTopic -f /home/ec2-user/paras_agent_pulsar/Inbound/Pulsar_JSON_Inbound.json [/aux_code]

7. Message Monitoring:

Open this article in the interactive viewer →