SK SKYVVA Documentation

4. Pulsar Adapter

Introduction:

Pulsar Adapter is basically an Event-based communication. Event-based communication contains two main components: Publish (Producer) and Subscribe (Consumer). The work of a publisher is to publish messages into a queue or topic which is Kafka/Pulsar and the middleware tool like this will maintain the message, these adapters follow the principle of Publish and Subscribe. And they will deliver messages to the consumer. Then all the applications can subscribe. For example, Netflix plays the role of a publisher. and we play the role of the subscriber(Consumer).

Event-based Communication:

How does event-driven architecture work?

SKYVVA Integration is a comprehensive set of integration and messaging technologies to connect applications and data across hybrid infrastructures. It is an agile, distributed, containerized, and API-centric solution. It provides service composition and orchestration, application connectivity and data transformation, real-time message streaming, change data capture, and API management—all combined with a cloud-native platform and toolchain to support the full spectrum of modern application development.

We all use Netflix to watch movies. It uses the Queuing tool and streaming tool. Netflix here plays the role of producer and we play the role of the consumer. Netflix uploads Movie once and all others who are subscribers of Netflix can watch. They do not need to request again and again. To send it individually it takes so much time, here we just needed to upload once and all the subscribers will get it.

#### Event-Driven Technology Terminology:

We have 5 main Event terminology.

Check the picture below for a description.

Any Connect:

Pulsar Adapter:

We have 2 Pulsar Adapter-

We use an 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 who is a camel consumer. We don't need a scheduler. We can consume immediately. This is the Inbound process because we are receiving data here.

We need an Outbound Pulsar Adapter when we want to send data out from salesforce, here We need to create a topic first. From salesforce, we can send data messages to the API endpoint of our agent, and then we have a camel producer to publish into the topic invoice, which is on the Kafka side. This is the outbound process because we are sending data. Check the picture given below for reference.

Case 1

How to use an Agent Pulsar adapter for consumers?

Step1: Click on Agent Control Board TabHow to use the Agent Control Board?

Since the user now completely understand; How to use the Agent Control Board, by hitting the upper link, now we understand the Architect of the Agent Control Board now follows below on Salesforce org.

Step2: Create Adapter:

Step3: Configure Interface page:

Step4: 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] Step5: Do Mapping:

Step6: Callout to Pulsar Server: [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] Command: (User 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]

Step7: Message Monitoring:

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

Step3: Configure Interface page:

Step4: 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] Step5: Do Mapping:

Step6: 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]

Step7: Message Monitoring:

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

Step3: Configure Interface page:

Step4: 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] Step5: Do Mapping:

Step6: 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]

Step7: Message Monitoring:

Case 2

How to use an Agent Pulsar adapter for Producer?

Step1: Click on Agent Control Board TabHow to use the Agent Control Board?

Since the user now completely understand; How to use the Agent Control Board, by hitting the upper link, now we understand the Architect of the Agent Control Board now follows below on Salesforce org.

Step2: Create Adapter:

Step3: Configure Interface page:

Step4: Do Mapping:

Step5: Callout: [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl(); c.returnJSONComplete=true; c.actionDoIntegrate=true; c.isCreateMessage=true; String[] ids= new String[]{'0016E00001CHaYWQA1','0016E00001CHaYXQA1'}; //Account Record Ids List result = skyvvasolutions.Iservices.invokeCalloutV3('Agent_Pulsar_Adapter','Pulsar_CSV_Outbound',ids,'SYNC',c); [/aux_code] Step6: Callout to pulsar server: [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] Command :( You need to execute below command on ec2 new agent-tools-server command prompt). pulsar-client consume -n 0 -s test non-persistent://vip/skyvva/OutboundCSVTopic Separator: Comma ( , ) OR Semi Colon ( ; ) OR Tab ( Tab ) OR Pipe ( | ) [/aux_code]

Step7: Message Monitoring:

Open this article in the interactive viewer →