How to listen to Salesforce Platform Event from simple CometD application using Java programming?

1. Install Java Development Kit 8 or later.

2. Download and Install Apache Maven.

3. Download and Install Eclipse.

4. Use the following command to clone the sample CometD connector.
git clone

5. Import the project using Eclipse.

6. Create a simple Platform Event.

7. In the /src/main/java/com/salesforce/emp/connector/example folder, Right-click the file and select Run As | Run Configurations.

8. On the Arguments tab, add values for the following arguments, separated by a space.

username password /event/API_Name_Of_The_Event.

9. Publish an event from Salesforce to see it in the Eclipse Console.

Sample Code:
Test_Event__e objEvent = new Test_Event__e( Test__c = String.valueOf( ) );
EventBus.publish( objEvent );

No comments:

Post a Comment