Skip to content

alexwoolford/sfdc-streaming-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SFDC streaming

This is a quick & dirty example that shows how to capture changes in Salesforce.com, in real-time, and publish them to a Kafka topic.

First, it's necessary to create a topic based on an SOQL query. To do that, tweak the snippet of Apex code and execute it:

PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'ContactUpdates';
pushTopic.Query = 'SELECT id, firstname, lastname, accountid, email FROM contact';
pushTopic.ApiVersion = 39.0;
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
insert pushTopic;

Then edit the properties file (src/main/java/io/woolford/resources/application.properties) - add your own SFDC login, and Kafka broker.

The sfdc.password property is the concatenation of the password and the SFDC security token.

Build and run the project:

mvn clean package
nohup java -jar target/sfdc-streaming-1.0-SNAPSHOT.jar &

That's it! Changes to contacts will be published, in JSON format, to the 'contact-updates' Kafka topic.

Publish updates from SFDC to Kafka

About

Streaming push notifications from Salesforce.com to Kafka

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages