Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Clarification on documentation: "eachBatch’s batch size never exceeds 1.*" #350

Open
Labels
documentationImprovements or additions to documentation questionA question is asked
@vikas-goswami

Description

Hi Team,

We are migrating to Javascript client from KafkaJS and using APIs under:
const { Kafka } = require("@confluentinc/kafka-javascript").KafkaJS;

We would like to understand what does this statement mean in migration documentation present here: reference to doc

The statement mentions:
eachBatch’s batch size never exceeds 1.
However, doesn't that mean eachBatch will behave just like eachMessage since size is limited to 1?

I tried to do a quick POC with this snippet:

 await consumer.run({
 eachBatch: async ({ batch, resolveOffset, heartbeat, isRunning, isStale }) => {
 console.log(`[${instanceId}] Received batch with ${batch.messages.length} messages`);
 console.log(`[${instanceId}] Batch info:`, {
 topic: batch.topic,
 partition: batch.partition,
 firstOffset: batch.firstOffset(),
 lastOffset: batch.lastOffset()
 });
 for (const message of batch.messages) {
 if (!isRunning() || isStale()) break;
 
 console.log(`[${instanceId}] Processing message:`, {
 offset: message.offset,
 value: message.value.toString()
 });
 
 await resolveOffset(message.offset);
 //await heartbeat();
 console.log(`[${instanceId}] Started`);
 for (let i = 0; i < 10000000; ) { 
 // Simulate processing delay
 i++;
 }
 console.log(`[${instanceId}] Done`);
 }
 }
 });

and I could see in logs that batch size is coming as more than 1 frequently, proving that no such limit is not in place.

So, can you please clarify what this statement means: eachBatch’s batch size never exceeds 1. and if there are any plans to limit eachBatch's size to 1 since it will affect our migration.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation questionA question is asked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /