Code Monkey home page Code Monkey logo

kafka-examples's Introduction

Collection of Kafka code examples.

kafka-examples's People

Contributors

gwenshap avatar kmizumar 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kafka-examples's Issues

Kafka 0.9

Have you had any problems with these working with Kafka 0.9 ?

Consumer is not receiving any messages

We are trying to use the same from code , but consumer topic is not receiving any messages on target side
export CLASSPATH=/Users/sxe518/Documents/test/MirrorMakerHandler/target/TopicSwitchingHandler-1.0-SNAPSHOT.jar
bin/kafka-mirror-maker.sh --consumer.config config/consumer.properties --producer.config config/producer.properties --whitelist test_.* —message.handler com.shapira.examples.TopicSwitchingHandler --message.handler.args ‘test,test123’
MirrorMakerHandler.zip

Failure on altering offsets on AdminClientExample/src/main/java/org/example/AdminClientExample.java

I'm using the AdminClientExample in order to reset offset for a specific topics as follows:
I'm trying to reset offsets for specific group id as follows:

 // Pause Connectors
    Await.result(k8sService.setPauseToConnectorsAsync(true), Duration.Inf)

    // Get Current Offsets
    val originalState = kafkaService.getCurrentState()

    // Reset Offsets
    kafkaService.resetOffsets(originalState)

when resetOffsets is as follows:

 def resetOffsets(originalState: Map[GroupID, mutable.Map[TopicPartition, OffsetAndMetadata]]): Unit = {
    logger.info(s"resetOffsets(originalState = $originalState) Triggered")
    for ((groupId, partitionsToOffsets) <- originalState) {
      logger.info(s"resetOffsets($groupId) Triggered")
      client.alterConsumerGroupOffsets(groupId, partitionsToOffsets.view.mapValues(_ => new OffsetAndMetadata(0)).toMap.asJava).all().get(config.operationTimeoutInMillis, TimeUnit.MILLISECONDS)
    }
  }

But its fails with

org.apache.kafka.common.errors.UnknownMemberIdException: Failed altering consumer group offsets for the following partitions

Any ideas how to solve it? or how to reset the offsets for specific group.id with other way?
enter image description here

SimpleMovingAvgZkConsumer.java doesn't seem to read properly

I've compared the SimpleMovingAvgZkConsumer.java code with what was presented in the Kafka video from O'Reilly, and have successfully compiled it, but it just does not want to calculate the moving average and present it to the screen.

I've tried using both the SimpleCounter.java and the kafka-console-producer.sh to produce the numbers that SimpleMovingAvgZkConsumer.java needs, but it just remains silent until the timeout is reached and then it exits.

I'm thinking that I'm getting some kind of mismatch between the Old and New producer types, but I'm too much of a newb to be able to figure it out.

I will add that the kafka-console-consumer.sh works fine reading from both SimpleCounter.java and kafka-console-producer.sh, so it would appear that my Kafka 2 node cluster is working properly

Any sugestions?

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.