[ 
https://issues.apache.org/jira/browse/CAMEL-27197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-27197 started by Claus Ibsen.
-------------------------------------------
> camel-pulsar - batcherBuilder cannot be set from a String (DEFAULT, KEY_BASED)
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-27197
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27197
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-pulsar
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> h3. What happens
> The producer option {{batcherBuilder}} is documented as an enum with 
> {{DEFAULT}} and {{KEY_BASED}}, but neither value can be set in an endpoint 
> URI or as a property. The route fails to start:
> {noformat}
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: 
> pulsar://persistent/public/default/kskb?batcherBuilder=KEY_BASED&... due to: 
> Error binding property (batcherBuilder=KEY_BASED) with name: batcherBuilder 
> on bean: pulsar://persistent/public/default/kskb?batcherBuilder=KEY_BASED&... 
> with value: KEY_BASED: No type converter available to convert from type: 
> java.lang.String to the required type: 
> org.apache.pulsar.client.api.BatcherBuilder
> {noformat}
> h3. How to reproduce
> {code}
> pulsar:persistent/public/default/kskb?serviceUrl=pulsar://localhost:6650&batcherBuilder=KEY_BASED
> {code}
> h3. Where
> {{components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConfiguration.java}}:
> {code:java}
> @UriParam(label = "producer", description = "Control batching method used by 
> the producer.", defaultValue = "DEFAULT",
>           enums = "DEFAULT,KEY_BASED")
> private BatcherBuilder batcherBuilder = BatcherBuilder.DEFAULT;
> {code}
> {{BatcherBuilder}} is an interface; {{DEFAULT}} and {{KEY_BASED}} are static 
> fields on it, so the enum values in the catalog do not match anything a 
> converter can produce. Only a bean reference ({{#bean:...}}) works.
> h3. Suggested fix
> Either add a {{@Converter}} in camel-pulsar from {{String}} to 
> {{BatcherBuilder}} that maps {{DEFAULT}} and {{KEY_BASED}} to the static 
> fields, or make the option a String/enum and map it in {{PulsarProducer}} 
> when the producer is built (keeping a way to pass a custom {{BatcherBuilder}} 
> bean). Add a test with {{batcherBuilder=KEY_BASED}} in the URI.
> Without it, key-based batching (one batch per key, so that a {{Key_Shared}} 
> subscription spreads the keys while batching stays on) cannot be configured; 
> the Kamelet {{pulsar-sink}} cannot offer it.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to