Core Java - Interview Questions and Answers for 'Consumer' - 6 question(s) found - Order By Newest Q1. Difference between Predicate, Supplier and Consumer ? Core Java
Ans. Predicate represents an anonymous function that accepts one argument and produces a result.
Supplier represents an anonymous function that accepts no argument and produces a result.
Consumer represents an anonymous function that accepts an argument and produces no result. Sample Code for Predicate Sample Code for Supplier Sample Code for Consumer Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java8   predicate   consumer   supplier   lambda expression   predicate vs consumer vs supplier expert Q2. Can we have multiple threads consuming message stream from a single partition ?
Ans. Yes, by having multiple Consumer Groups. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer  kafka topic partitions  bigdata  consumer group Q3. Can we have multiple threads consuming messages from a single partition if we have single Consumer Group ?
Ans. No, we can only have max 1 thread per partition in a single Consumer Group. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer  kafka topic partitions  bigdata  consumer group Q4. If we have more threads than partitions in a kafka consumer, How can we model it efficiently ?
Ans. We will have to use multiple consumer groups in that case as threads will remain idle if we use single consumer group. A more sophisticated algorithm could be required with multiple groups if we have to ensure the order of consumption. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer  kafka topic partitions  bigdata  consumer group This question was recently asked at 'Dell'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  producer consumer problem  multi-process synchronization problem Asked in 1 Companies Q6. How can we makes sure that message has been consumed properly from Kafka ? Apache Kafka
Ans. We can have a mechanism to send the conformation back to Kafka so that Kafka can do offset only after receiving the confirmation. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer