kafka-consumer-api

Conditions in which Kafka Consumer (Group) triggers a rebalance

只愿长相守 提交于 2019-12-04 05:54:54
I was going through the Consumer Config for Kafka. https://kafka.apache.org/documentation/#newconsumerconfigs what are the parameters that will trigger a rebalance ?. For instance the following parameter will ?. Any other parameters which we need to change or will defaults suffice connections.max.idle.ms Close idle connections after the number of milliseconds specified by this config. long 540000 medium Also we have three different topics Is it a bad idea to have the same Consumer Group (Same ID) consuming from multiple topics. Assuming if the above scenario is valid (not necessarily the best

multiprocessing in kafka-python

十年热恋 提交于 2019-12-04 05:34:11
I have been using the python-kaka module to consume from a kafka broker. I want to consume from the same topic with 'x' number of partitions in parallel. The documentation has this : # Use multiple consumers in parallel w/ 0.9 kafka brokers # typically you would run each on a different server / process / CPU consumer1 = KafkaConsumer('my-topic', group_id='my-group', bootstrap_servers='my.server.com') consumer2 = KafkaConsumer('my-topic', group_id='my-group', bootstrap_servers='my.server.com') Does this mean I can create a separate consumer for each process that I spawn? Also, will there be an

What is the best way to publish and consume different type of messages?

心已入冬 提交于 2019-12-04 04:34:05
问题 Kafka 0.8V I want to publish /consume byte[] objects, java bean objects, serializable objects and much more.. What is the best way to define a publisher and consumer for this type scenario? When I consume a message from the consumer iterator, I do not know what type of the message it is. Can anybody point me a guide on how to design such scenarios? 回答1: I enforce a single schema or object type per Kafka Topic. That way when you receive messages you know exactly what you are getting. At a

Spring kafka consumer, seek offset at runtime?

我与影子孤独终老i 提交于 2019-12-04 01:28:38
问题 I am using the KafkaMessageListenerContainer for consuming from the kafka topic, I have an application logic to process each record which is dependent on other micro services as well. I am now manually committing the offset after each record is processed. But if I the application logic fails I need to seek to the failed offset and keep processing it until it's succeeds. For that I need to do a run time manual seek of the last offset. Is this possible with the KafkaMessageListenerContainer yet

Killing node with __consumer_offsets leads to no message consumption at consumers

二次信任 提交于 2019-12-03 20:43:18
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 metadata for console-consumer-85124 with generation 2 (kafka.coordinator.GroupCoordinator) [2017-06-30

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

杀马特。学长 韩版系。学妹 提交于 2019-12-03 17:29:36
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 suggest me the right way to do it. Error message: *************************** APPLICATION FAILED TO START **

Kafka High-level Consumer error_code=15

僤鯓⒐⒋嵵緔 提交于 2019-12-03 14:44: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 response ClientResponse(receivedTimeMs=1487666631306, disconnected=false, request=ClientRequest

Kafka multiple consumers for a partition

天大地大妈咪最大 提交于 2019-12-03 13:49:15
I have a producer which writes messages to a topic/partition. To maintain ordering, i would like to go with single partition and I want 12 consumers to read all the messages from this single partition(no consumer group, all the messages should go to all consumers). Is this achievable? I read some forums that only one consumer can read per partition. You may use SimpleConsumer to achieve exactly what you are asking - no consumer groups, all consumers can read a single partition. However this approach means you have to handle offset storing and broker failure handling yourself. Another option is

Kafka topic partition and Spark executor mapping

限于喜欢 提交于 2019-12-03 13:36:55
问题 I am using spark streaming with kafka topic. topic is created with 5 partitions. My all messages are published to the kafka topic using tablename as key. Given this i assume all messages for that table should goto the same partition. But i notice in the spark log messages for same table sometimes goes to executor's node-1 and sometime goes to executor's node-2. I am running code in yarn-cluster mode using following command: spark-submit --name DataProcessor --master yarn-cluster --files /opt

Kafka consumer offset max value?

冷暖自知 提交于 2019-12-03 11:55:08
问题 I was googling and reading Kafka documentation but I couldn't find out the max value of a consumer offset and whether there is offset wraparound after max value. I understand offset is an Int64 value so max value is 0xFFFFFFFFFFFFFFFF. If there is wraparound, how does Kafka handle this situation? 回答1: According to this post, the offset is not reset: We don't roll back offset at this moment. Since the offset is a long, it can last for a really long time. If you write 1TB a day, you can keep