Giter Site home page Giter Site logo

kafkademo's Introduction

Kafka Demo

概要

Kafka API(Java)を利用した簡単な KafkaProducer と KafkaConsumer。

参考した資料はこちら

使い方

  1. mavenでパッケージング

    $ mvn package
    
    // fat jar が作成される
    $ ls -ahl target/KafkaDemo-1.1-SNAPSHOT-jar-with-dependencies.jar 
    -rw-r--r--  1 bliu2  staff    17M Oct  2 18:08 target/KafkaDemo-1.1-SNAPSHOT-jar-with-dependencies.jar 
    
  2. producer起動

    $ java -classpath ./KafkaDemo-1.1-SNAPSHOT-jar-with-dependencies.jar [-DmessageCount=送信するメッセージ数] [-DclientId=producer識別子] [-DtopicName=topic名] [-DkafkaBrokers=brokerリスト] ind.bliu.demo.kafka.AppProducer
    
    • messageCount 送信するメッセージ数。指定なしの場合は1000
    • clientId producerの識別子。指定なしの場合はclient1
    • topicName 送信先トピック名。指定なしの場合はmytopic
    • kafkaBrokers kafka brokerリスト。指定なしの場合は10.0.0.62:9092,10.0.0.200:9092,10.0.0.16:9092
  3. consumer起動

    $ java -classpath ./KafkaDemo-1.1-SNAPSHOT-jar-with-dependencies.jar [-DtopicName=topic名] [-DclientId=consumer識別子] [-DgroupId=consumer group名] [-DoffsetReset=latest|earliest] [-DkafkaBrokers=brokerリスト] [-DmaxNoMessageFoundCount=consumer待機時間] ind.bliu.demo.kafka.AppConsumer
    
    • groupId consumer group名。指定なしの場合はgroup1
    • clientId consumerの識別子。指定なしの場合はclient1
    • offsetReset consumerの受信開始offset(latestまたはearliest)。指定なしの場合はearliest
    • maxNoMessageFoundCount consumerが終了するまでに、メッセージ受信しない状態が続く最大時間(秒)。指定なしの場合は100
    • topicName 受信先トピック名。指定なしの場合はmytopic
    • kafkaBrokers kafka brokerリスト。指定なしの場合は10.0.0.62:9092,10.0.0.200:9092,10.0.0.16:9092

kafkademo's People

Contributors

beenryuu avatar

Watchers

James Cloos 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.