Claus Ibsen created CAMEL-27635:
-----------------------------------

             Summary: camel-jooq: unresolvable entityType class ignored 
silently; consumer ignores query option
                 Key: CAMEL-27635
                 URL: https://issues.apache.org/jira/browse/CAMEL-27635
             Project: Camel
          Issue Type: Bug
          Components: camel-jooq
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-jooq for CAMEL-23832 (PR 
https://github.com/apache/camel/pull/30969).
These are separate problems of the component; the descriptions PR only 
documents the current behavior.

h4. 1. A class name in the URI path that cannot be resolved is ignored without 
an error
{{JooqComponent.initConfiguration()}} calls 
{{ClassResolver.resolveClass(className)}} and sets {{entityType}} only when the 
result is not null. A typo in the class name (for example 
{{jooq:com.foo.BokRecord}}) therefore creates the endpoint and starts the route 
without an error.
The failure comes later: the consumer fails at every poll in 
{{JooqConsumer.getTable()}} ({{ObjectHelper.newInstance(null)}}, a 
RuntimeCamelException that wraps a NullPointerException), and the NONE 
operation of the producer fails for every message in 
{{JooqEndpoint.createProducerExpression()}} ({{getBody(null)}}, a 
NullPointerException). Neither error names the class that was not found.
Proposed change: fail endpoint creation with an IllegalArgumentException that 
names the class when it cannot be resolved (for example with 
{{resolveMandatoryClass}}).

h4. 2. The consumer ignores the query option
{{JooqConsumer.poll()}} always runs 
{{selectFrom(getTable(entityType)).fetch()}}, so it reads every row of the 
table of the {{entityType}}. The {{query}} option (label producer) is not used 
by the consumer. The route {{sql-consume}} in 
{{src/test/resources/camel-context.xml}} sets {{query}} on a {{from}} endpoint, 
which suggests that the consumer runs that query; it does not, and no test 
checks it.
Proposed change: either remove {{query}} from the consumer route in the test, 
or support a select query in the consumer (which then needs a way to delete the 
consumed rows when {{consumeDelete=true}}).

_Claude Code on behalf of davsclaus_



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

Reply via email to