Giter Site home page Giter Site logo

New BPL library for Kafka about brain4it HOT 3 CLOSED

brain4it avatar brain4it commented on May 28, 2024
New BPL library for Kafka

from brain4it.

Comments (3)

raneq avatar raneq commented on May 28, 2024

From the core apis, we don't need to implement all of them:

  • Consumer: yes. To un/subscribe from/to topics and read from them.
  • Producer: yes. To read from topics.
  • Streams: maybe. A stream reads from a topic, transforms data, and writes to another topic.
  • Connect: no. Kafka connectors are internal consumers (sink connectors) or producers (source connectors) loaded at Kafka Connectors, managed by the same Kafka platform.
  • Admin: yes. To create or delete topics straight from brain4it.

from brain4it.

raneq avatar raneq commented on May 28, 2024

Some notes on...

Clustering

  • Kafka can be run in a cluster of nodes, where the message processor are called brokers.
  • Each topic is split into a pre-defined number of partitions, and each partition is replicated with some replication factor. That means that not all brokers will have all of partitions
  • For each (replicated) topic partition, there is exactly one broker that is the topic partition leader.
  • Producers can only write to the topic-partition leader
  • Consumers can only read from the topic-partition leader
  • All Kafka nodes can answer a request for cluster state metadata about which nodes are alive and who are the leaders for each partition of each topic.
  • Clients should know more than one cluster server (bootstrap nodes), but don't need to know about all of them beforehand, as all nodes know about all others in the cluster.
  • Ideally, There are more topic partitions than brokers, and each broker is leader of a proportional amount of partitions, so that there isn't a single leader-of-all broker.
  • Producers control which partition they publish messages to.
    WIP

from brain4it.

realor avatar realor commented on May 28, 2024

This library could have the following methods:

(set kid (kafka-create "producer|consumer" config))
(kafka-send kid topics message)
(kafka-poll kid topics millis)
(kafka-destroy kid)

Examples:

(set kid (kafka-create "producer" "localhost:9092"))
(kafka-send kid "containers" "hello world")
(kafka-send kid ("containers" "lights") message)
(kafka-destroy kid)

(set kid (kafka-create "consumer" "localhost:9092"))
(set msg (kafka-poll kid "containers" 10))
...
(kafka-destroy kid)

(set kid (kafka-create "consumer" ("servers" => ("10.1.20.87:9092" "10.1.20.88:9092") "key-deserializer" => "StringDeserializer" "value-deserializer" => "StringDeserializer" "group" => "test-group")))

from brain4it.

Related Issues (1)

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.