GithubHelp home page GithubHelp logo

lazykafka's Introduction

Client for Apache Kafka written in GO

NOTE: This is a stripped down version of Shopify/Sarama Kafka GO client. I wanted to learn how they did it so I have applied some reverse engineering and started building it from the very bottom.

Example:

// get default config or define your own config
conf := lazykafka.NewConfig()

// Create a broker target for the given address
b := lazykafka.NewBroker("127.0.0.1:9092")

// Open a connection to the targeted broker
b.Open(conf)

// Check if you are connected to the broker
fmt.Println(b.Connected())

Once you connect to a broker, you can start by creating a new Topic using CreateTopics function on broker object

retention := "-1"
req := &lazykafka.CreateTopicsRequest{
    TopicDetails: map[string]*lazykafka.TopicDetail{
        "topic_via_tcp": {
            NumPartitions:     -1,
            ReplicationFactor: -1,
            ReplicaAssignment: map[int32][]int32{
                0: []int32{0, 1, 2},
            },
            ConfigEntries: map[string]*string{
                "retention.ms": &retention,
            },
        },
    },
    Timeout: 100 * time.Millisecond,
}
b.CreateTopics(req)

lazykafka's People

Stargazers

Rehaan avatar

Watchers

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