Giter VIP home page Giter VIP logo

hello-play-kafka's Introduction

Hello Play Kafka

Cloud Setup

  1. Deploy on Heroku

  2. Install the Kafka plugin into the Heroku CLI

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

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

     heroku kafka:topics:create RandomNumbers --partitions 32 -a YOUR_APP
    
  5. Add a new Kafka consumer group:

     heroku kafka:consumer-groups:create main
    
  6. Watch the Kafka log

     heroku kafka:topics:tail RandomNumbers -a YOUR_APP
    
  7. Check out the random numbers:

     heroku open -a YOUR_APP
    

Local Setup

This uses the same Kafka system as above.

  1. Clone the source:

     git clone https://github.com/jamesward/hello-play-kafka
    
  2. Associate the local source with your Heroku app:

     heroku git:remote -a YOUR_APP
    
  3. Setup a .env file with the necessary info:

     heroku config -s > .env
    
  4. Run the web app:

     set -o allexport
     source .env
     set +o allexport
     ./sbt ~run
    
  5. Run the worker:

      set -o allexport
      source .env
      set +o allexport
     ./sbt "runMain workers.RandomNumbers"
    
  6. Check out the app: http://localhost:9000

hello-play-kafka's People

Contributors

jamesward avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hello-play-kafka's Issues

def sink(topic: String)

Hello

In this code, you could avoid topic, because it was chosen in ProducerRecord (and reactive-kafka api do not require it)

def sink(topic: String): Try[Sink[ProducerRecord[String, String], NotUsed]] = {
    producerSettings.map(Producer.plainSink)
}

to:

def sink: Try[Sink[ProducerRecord[String, String], NotUsed]] = {
    producerSettings.map(Producer.plainSink)
}

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.