question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Producer hangs when using BatchBuilder.KeyBased

See original GitHub issue

When using the KEY_BASED BatchBuilder it is impossible to send messages. The producer hangs forever and nothing happens.

Sample code:

var client = await new PulsarClientBuilder()
    .ServiceUrl("pulsar://localhost:6650")
    .BuildAsync();

await using var producer = await client.NewProducer(Schema.STRING())
    .Topic("some-topic")
    .EnableBatching(true)
    .BatchBuilder(BatchBuilder.KeyBased)
    .CreateAsync();

// this hangs when using BatchBuilder.KeyBased
await producer.SendAsync("Oh no!");

I’ve tested this code against pulsar:2.11.0 and pulsar:3.0.0. The Pulsar.Client version is 2.12.6.

Issue Analytics

  • State:closed
  • Created a month ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Lanayxcommented, Aug 9, 2023

I’ve pushed a fix for empty key case, will publish a nuget once CI will pass. However what I’ve found that the docs from pulsar site you linked don’t correspond to the code - NON_KEY value is never sent (such thing doesn’t exist in the codebase) so I just used empty string as well.

1reaction
adrianotrcommented, Aug 9, 2023

To answer my own question:

What should happen when messages have an OrderingKey?

It will use the ordering key as the batch key, when the ordering key is specified, as seen in the source code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apache Pulsar 2.8.0
In this case, you need to rebuild your Function using Apache Pulsar 2.8.0 as a dependency and redeploy it. If you are running...
Read more >
Apache Pulsar Release Notes (Legacy)
NotSerializableException occurs when we use ... Fixed C++ client producer sendAsync() hang when no enough batched message #4657 ...
Read more >
2.9.0 Milestone
[Java Client] Let producer reconnect for state RegisteringSchema ... [PIP 95][Issue 12040][broker] Decouple advertised listeners from bind ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found