Claus Ibsen created CAMEL-27601:
-----------------------------------
Summary: camel-cassandraql: unused clusterName, limit_n case,
silent extraTypeCodecs, metadata gaps
Key: CAMEL-27601
URL: https://issues.apache.org/jira/browse/CAMEL-27601
Project: Camel
Issue Type: Bug
Components: camel-cassandraql
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-cassandraql for
CAMEL-23832 (PR https://github.com/apache/camel/pull/30937).
These are separate problems of the component; the descriptions PR only
documents the current behavior.
h4. 1. clusterName option does nothing
{{CassandraEndpoint}} stores {{clusterName}}, but {{createSessionBuilder()}}
never passes it to the driver, and no other code reads it. A user who sets it
sees no effect.
Proposed change: deprecate the option (the 4.x driver has no cluster name
setting on the session builder), or map it to a driver setting if one fits.
h4. 2. resultSetConversionStrategy=limit_10 fails, while all and one work in
lower case
{{CassandraComponent.createEndpoint()}} matches {{ALL}} and {{ONE}} with
{{equalsIgnoreCase}}, but {{LIMIT_}} only with {{startsWith("LIMIT_")}}. A
lower-case {{limit_10}} stays in the parameters, and {{setProperties()}} then
fails, as there is no type converter from String to
{{ResultSetConversionStrategy}}. {{ResultSetConversionStrategies.fromName()}}
itself accepts any case.
Proposed change: match the prefix ignoring case, or call {{fromName()}} for any
value that does not start with {{#}}.
h4. 3. Unknown name in extraTypeCodecs is ignored silently
{{CassandraEndpoint.createSessionBuilder()}} converts each name with
{{TypeConverter.tryConvertTo(CassandraExtraCodecs.class, codec)}} and skips it
when the result is null. A typo such as {{BLOB_TO_ARAY}} registers no codec and
logs nothing; the user only sees a codec error later, when a row is read or
written.
Proposed change: use {{mandatoryConvertTo}} (or throw an
IllegalArgumentException that lists the valid names), so the endpoint fails to
start.
h4. 4. consistencyLevel is an undocumented endpoint option
{{CassandraEndpoint}} has a {{consistencyLevel}} field with a setter, and
{{prepareStatement(String)}} sets it on every prepared statement. The field has
no {{@UriParam}}, so it is not in the generated configurer, the component JSON,
the doc page or the Endpoint DSL. {{?consistencyLevel=ANY}} still works through
the reflection fallback ({{CassandraComponentProducerIT}} uses it), but tools
that validate against the catalog report it as unknown.
Proposed change: add {{@UriParam}} with a description (and align the getter
type, {{ConsistencyLevel}}, with the setter type, {{DefaultConsistencyLevel}}).
h4. 5. CamelCqlResumeAction is documented as a consumer header, but it is a
registry name
{{CassandraConstants.CASSANDRA_RESUME_ACTION}} has {{@Metadata(label =
"consumer")}} and is listed among the headers. {{CassandraConsumer.doStart()}}
passes it to {{ResumeStrategyHelper.resume()}}, which looks up a
{{ResumeAction}} bean by this name in the registry. No code reads or sets it as
a message header.
Proposed change: remove the {{@Metadata}} so it is not listed as a header, and
document the bean name in the resume section of the doc page.
h4. 6. CamelCqlQuery header has javaType String, but also accepts a
SimpleStatement
{{CassandraProducer.executePreparedStatement()}} and {{executeStatement()}}
accept a {{String}} or a
{{com.datastax.oss.driver.api.core.cql.SimpleStatement}} in the header. The
metadata says {{javaType = "String"}}.
Proposed change: set {{javaType = "Object"}} (or document both types).
h4. 7. resultSetConversionStrategy has no defaultValue
The field defaults to {{ResultSetConversionStrategies.all()}}, but the
{{@UriParam}} has no {{defaultValue = "ALL"}}, so the catalog shows no default.
Proposed change: add {{defaultValue = "ALL"}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)