smallrye-reactive-messaging icon indicating copy to clipboard operation
smallrye-reactive-messaging copied to clipboard

Is not possible to add a custom batchReceivePolicy to the consumer

Open hermeswaldemarin opened this issue 9 months ago • 3 comments

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

` @Produces @Identifier("goals") public ConsumerConfigurationData<String> getConsumerGoalsConfig() { ConsumerConfigurationData<String> 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()); }

hermeswaldemarin avatar May 21 '24 17:05 hermeswaldemarin