kafka-consumer-api

How does (should) Kafka Consumer cope with Poison Messages

北战南征 提交于 2019-12-05 07:25:34
When a Kafka Consumer fails to deserialize a message, is it the client applications responsibility to deal with the Poison Message? Or Does Kafka "increment" the message offset and continue consumption of valid messages? Is there a "Best Practice" for dealing with Poison Messages held on Kafka topics? When Kafka is unable to deserialize the record the consumer will receive a org.apache.kafka.common.KafkaException , you should commit the offset yourself and keep consuming. 来源: https://stackoverflow.com/questions/35991849/how-does-should-kafka-consumer-cope-with-poison-messages

Is it possible to obtain specific message offset in Kafka+SparkStreaming?

旧街凉风 提交于 2019-12-05 06:45:08
I'm trying to obtain and store the offset for a specific message in Kafka by using Spark Direct Stream. Looking at the Spark documentation is simple to obtain the range offsets for each partition but what I need is to store the start offset for each message of a topic after a full scan of the queue. Yes, you can use MessageAndMetadata version of createDirectStream which allows you to access message metadata . You can find example here which returns Dstream of tuple3 . val ssc = new StreamingContext(sparkConf, Seconds(10)) val kafkaParams = Map[String, String]("metadata.broker.list" ->

Is it possible to transfer files using Kafka?

ぐ巨炮叔叔 提交于 2019-12-05 04:41:59
I have thousands of files generated each day which I want to stream using Kafka. When I try to read the file, each line is taken as a separate message. I would like to know how can I make each file's content as a single message in Kafka topic and with consumer how to write each message from Kafka topic in a separate file. Rambler You can write your own serializer/deserializer for handling files. For example : Producer Props : props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.StringSerializer); props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,

How to connect Kafka with Elasticsearch?

我们两清 提交于 2019-12-05 04:22:26
I am new in Kafka, I use kafka to collect netflow through logstash(it is ok), and I want to send the data to elasticsearch from kafka, but there are some problems. My question is how can I connect Kafka with Elasticsearch? netflow to kafka logstash config: input{ udp{ host => "120.127.XXX.XX" port => 5556 codec => netflow } } filter{ } output { kafka { bootstrap_servers => "localhost:9092" topic_id => "test" } stdout{codec=> rubydebug} } kafka to elasticsearch logstash: input { kafka { } } output { elasticsearch { hosts => ["120.127.XXX.XX:9200"] } stdout{codec=> rubydebug} } log: D:\ELK

How to use Spring Kafka's Acknowledgement.acknowledge() method for manual commit

瘦欲@ 提交于 2019-12-05 03:24:19
问题 I am using Spring Kafka first time and I am not able to use Acknowledgement.acknowledge() method for manual commit in my consumer code as mentioned here https://docs.spring.io/spring-kafka/reference/html/_reference.html#committing-offsets. Mine is spring-boot application. If I am not using manual commit process than my code is working fine. But when I use Acknowledgement.acknowledge() for manual commit it shows error related to bean. Also If I am not using manual commit properly please

Killing node with __consumer_offsets leads to no message consumption at consumers

丶灬走出姿态 提交于 2019-12-05 02:53:00
问题 I have 3 node(nodes0,node1,node2) Kafka cluster(broker0, broker1, broker2) with replication factor 2 and Zookeeper(using zookeeper packaged with Kafka tar) running on a different node (node 4). I had started broker 0 after starting zookeper and then remaining nodes. It is seen in broker 0 logs that it is reading __consumer_offsets and seems they are stored on broker 0. Below are sample logs: Kafka Version: kafka_2.10-0.10.2.0 2017-06-30 10:50:47,381] INFO [GroupCoordinator 0]: Loading group

Kafka consumer offsets out of range with no configured reset policy for partitions

别来无恙 提交于 2019-12-05 01:52:08
I'm receiving exception when start Kafka consumer. org.apache.kafka.clients.consumer.OffsetOutOfRangeException: Offsets out of range with no configured reset policy for partitions{test-0=29898318} I'm using Kafka version 9.0.0 with Java 7. So you are trying to access offset( 29898318 ) in topic( test ) partition( 0 ) which is not available right now. There could be two cases for this Your topic partition 0 may not have those many messages Your message at offset 29898318 might have already deleted by retention period To avoid this you can do one of following: Set auto.offset.reset config to

Consumer Stuck in Re-join

风流意气都作罢 提交于 2019-12-04 22:55:24
问题 I've read other threads and I've gotten around the problem by using a new group ID, however I'd like to understand what could cause this. I have a topic with 16 partitions, I've set session.timeout.ms=30000, and max.poll.interval.ms=30000000. I run my program, and ctrl+c it, so it's not closing properly. After I guess, 16 times, I get stuck in this re-join issue. session.timeout.ms is the heartbeat timeout, so after 30 seconds it should kick my consumer right and my partitions should "free up

Kafka : How to connect kafka-console-consumer to fetch remote broker topic content?

断了今生、忘了曾经 提交于 2019-12-04 22:49:47
问题 I have setup a kafka zookeeper and 3 brokers on one machine on ec2 with ports 9092..9094 and am trying to consume the topic content from another machine. The ports 2181 (zk), 9092, 9093 and 9094 (servers) are open to the consumer machine. I can even do a bin/kafka-topics.sh --describe --zookeeper 172.X.X.X:2181 --topic remotetopic which gives me Topic:remotetopic PartitionCount:1 ReplicationFactor:3 Configs: Topic: remotetopic Partition: 0 Leader: 2 Replicas: 2,0,1 Isr: 2,0,1 Blockquote

Kafka High-level Consumer error_code=15

让人想犯罪 __ 提交于 2019-12-04 22:17:28
问题 When trying to consume from Kafka using the high-level consumer (using a completely new consumer group), the consumer never starts running. When I switch the logging level to debug, I can see the following two lines repeating themselves over and over: DEBUG [AbstractCoordinator] 09:43:51.192: Sending coordinator request for group CompletelyNewConsumerGroupThatIneverUsedBefore to broker 172.30.3.61:30000 (id: 1043 rack: null) DEBUG [AbstractCoordinator] 09:43:51.306: Received group coordinator