Claus Ibsen created CAMEL-24955:
-----------------------------------

             Summary: camel-yaml-dsl-validator: report a direct: or seda: 
endpoint that no route consumes
                 Key: CAMEL-24955
                 URL: https://issues.apache.org/jira/browse/CAMEL-24955
             Project: Camel
          Issue Type: Improvement
          Components: camel-yaml-dsl
            Reporter: Claus Ibsen


A message sent to a route that is not there is decidable from the source, and 
today it is only found when the application starts - or not at all.

{code:yaml}
- route:
    from:
      uri: timer:tick
      steps:
        - to:
            uri: direct:lookup      # and no route consumes direct:lookup
{code}

With {{direct:}} the route fails to start - _No consumers available on endpoint 
direct://lookup_ - and {{DiagnoseData}} explains it after the fact. With 
{{seda:}} nothing fails at all: the message is queued and nothing reads it.

The other direction is the same question: a {{direct:}} route that nothing 
calls. That is what a whole-file rewrite leaves behind, and the file still 
validates.

h3. What it needs

{{RouteGraph}} from CAMEL-24844 already reads the routes and their endpoints 
from the source, in both spellings ({{direct:lookup}} and {{uri: direct}} with 
{{parameters: {name: lookup}}}). The check itself is small; what it needs is 
the rest of the project, because the routes of an application are spread over 
files and a file on its own cannot answer either question. The directory-aware 
checks in {{SourceValidator}} ({{validateResourceRefs}}, 
{{validateYamlBeanRefs}}) are the pattern: scan the sibling route files - and 
the Java ones, for {{from("direct:x")}} - and pass what they consume.

Without a directory the check says nothing.

h3. State

Written and tested against CAMEL-24844's graph - six tests covering the missing 
consumer, another file consuming it, an unknown directory, the same file, the 
seda wording and an external endpoint, which is not its business. Held back 
from https://github.com/apache/camel/pull/26800 because an unwired check is 
dead code; it lands with the sibling scan.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to