Coder Social home page Coder Social logo

sarama's Introduction

sarama

This is a sample project to use sarama, sarama is golang client library for Apache kafka. This repositry contains simple producer and consumer. To use this you need to prepare kafka (or you can run it by docker image).

Install

To get sarama,

$ go get github.com/Shopify/sarama

Build

To build producer & consumer, run below. Binary is generated in each directory,

$ make build

Usage

Ensure kafka is running on where you expect.

To execute consumer, run below. Consumer tries to fetch topic until received os.Interrupt signal.

$ ./consumer/consumer

To execute async-producer, run below. Producer tries to publish messages until received os.Interrupt signal.

$ ./async-producer/async-producer

Kafka on Docker

You can run kafka on docker. And you can also run producer & consumer on docker.

To build docker image of kafka,

$ make build-docker

To run kafka container,

$ ./docker-run.sh

To execute consumer,

$ docker exec -it kafka /work/consumer/consumer

To execute async-producer,

$ docker exec -it kafka /work/async-producer/async-producer

To execute http-log-producer,

$ docker exec -it kafka /work/http-log-producer/http-log-producer

And access it (e.g., docker is on boot2docker),

$ curl $(boot2docker ip):8080

Author

Taichi Nakashima

sarama's People

Contributors

tcnksm avatar

Watchers

wfxiang08 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.