Git Product home page Git Product logo

hello-kafka-salesforce's Introduction

Hello Kafka Salesforce

This simple app uses the Salesforce Streaming API to listen for events in Salesforce and then sends them to Kafka.

Cloud Setup

  1. Signup for a Salesforce Developer Org

  2. In Salesforce, create a PushTopic using the Execute Anonymous Apex feature in the Developer Console:

     PushTopic pushTopic = new PushTopic();
     pushTopic.Name = 'ContactUpdates';
     pushTopic.Query = 'SELECT Id, Name FROM Contact';
     pushTopic.ApiVersion = 36.0;
     pushTopic.NotifyForOperationCreate = true;
     pushTopic.NotifyForOperationUpdate = true;
     pushTopic.NotifyForOperationUndelete = true;
     pushTopic.NotifyForOperationDelete = true;
     pushTopic.NotifyForFields = 'Referenced';
     insert pushTopic;
    
  3. Deploy on Heroku

  4. Add the Heroku Kafka Addon to the app

     heroku addons:add heroku-kafka -a YOUR_APP
    
  5. Install the Kafka plugin into the Heroku CLI

     heroku plugins:install heroku-kafka
    
  6. Wait for Kafka to be provisioned:

     heroku kafka:wait -a YOUR_APP
    
  7. Add a new Kafka topic:

     heroku kafka:topics:create ContactUpdates --partitions 32 -a YOUR_APP
    
  8. Watch the Kafka log

     heroku kafka:topics:tail ContactUpdates -a YOUR_APP
    
  9. Make a change to a Contact in Salesforce and you should see the event in the Kafka log.

Local Setup

This uses the same Kafka system as above.

  1. Clone the source:

     git clone https://github.com/jamesward/hello-kafka-salesforce
    
  2. Setup a .env file with the necessary info:

     heroku config -s > .env
     echo "SALESFORCE_USERNAME=<YOUR SALESFORCE USERNAME>" >> .env
     echo "SALESFORCE_PASSWORD=<YOUR SALESFORCE PASSWORD>" >> .env
     set -o allexport
     source .env
     set +o allexport
    
  3. Run the app:

     ./activator ~run
    

hello-kafka-salesforce's People

Contributors

jamesward avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.