Raman Gupta answered your question in Slack. I copied and pasted his answer here.
Firstly, that Kafka call doesn't get *all* unread messages, it gets an undefined amount of messages which might be all or might be less (there are a bunch of consumer properties that control this like fetch.max.bytes and max.poll.records.Secondly, AIUI the Pulsar consumer does the same thing in the background but presents a simpler one-receive-per-message API to you the user. See receiverQueueSize for configuring <https://pulsar.apache.org/docs/en/client-libraries-java/#configure-consumer> this behavior.If you really want to receive a batch of messages all at once, you can use a batching receive <https://pulsar.apache.org/docs/en/client-libraries-java/#batch-receive>. - Sijie On Thu, Apr 9, 2020 at 8:53 AM Subash K <[email protected]> wrote: > Hi, > > > > I'm new to Pub-Sub systems and currently comparing features of Kafka and > Pulsar. I've started with simple producer and consumer and I notice a key > difference in the consumer API. > > - The Consumer API of Kafka poll ConsumerRecords<Integer, byte[]> > records = consumer.poll(0); gets all the unacknowledged messages > available in the topic at that point of time. > - But whereas the consumer API of Pulsar receive msg = > consumer.receive(0, TimeUnit.SECONDS); gets only one unacknowledged > message from the topic. > > I'm wondering is there any advantage seen in Pulsar by returning only one > message at a time. Can someone please help in clarifying? > > > > *P.S: I'm using the default subscription mode in consumer (Exclusive)* > > > > Regards, > > Subash Kunjupillai > > >
