Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is not possible to add a custom batchReceivePolicy to the consumer #2631

Closed
hermeswaldemarin opened this issue May 21, 2024 · 3 comments
Closed
Labels
bug Something isn't working pulsar

Comments

@hermeswaldemarin
Copy link

hermeswaldemarin commented May 21, 2024

When we add a configuration in Quarkus to provide a custom ConsumerConfigurationData with the batchReceivePolicy provided

`
@produces
@Identifier("goals")
public ConsumerConfigurationData getConsumerGoalsConfig() {
ConsumerConfigurationData data = new ConsumerConfigurationData<>();
data.setMaxPendingChunkedMessage(2000);
data.setBatchReceivePolicy(
BatchReceivePolicy.builder()
.messagesFromMultiTopicsEnabled(false)
.maxNumBytes(10 * 1024 * 1024)
.maxNumMessages(1000)
.timeout(30, TimeUnit.SECONDS)
.build());

return data;
}
`

This configuration is never sent to the builder..

We don't have here a if to set the batchReceivePolicy to the builder when the batchReceivePolicy is provided in the conf instance.

The process rely on this code.

Even if I provide the batchReceivePolicy property in the Map returned by configResolver.configToMap the builder.loadConf will not get this info because it can't handle complex attributes.

Will need to be used the same strategy used here to set the batchReceivePolicy to the builder.

Just adding this code make it work correctly

if (conf.getBatchReceivePolicy() != null) { builder.batchReceivePolicy(conf.getBatchReceivePolicy()); }

@ozangunalp
Copy link
Collaborator

I am sorry I couldn't totally follow the issue description.
Did you provide the batchReceive=true in channel attributes in addition to the batchReceivePolicy you are building using ConsumerConfigurationData ?

@hermeswaldemarin
Copy link
Author

hermeswaldemarin commented May 21, 2024

Hey @ozangunalp , yes I've provided the batchReceive=true and I'm providing the ConsumerConfigurationData setting the batchReceivePolicy there. But the batchReceivePolicy is never sent to the consumer builder in the PulsarIncomingChannel

@ozangunalp
Copy link
Collaborator

@hermeswaldemarin Indeed, it looks like a bug.

Also, not related to the bug but due to a limitation in CDI you'd need to produce a ConsumerConfigurationData<Object> for the programmatic configuration to be taken into account.

@ozangunalp ozangunalp added bug Something isn't working pulsar labels May 23, 2024
ozangunalp added a commit to ozangunalp/smallrye-reactive-messaging that referenced this issue Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pulsar
Projects
None yet
Development

No branches or pull requests

2 participants