I am trying to use the Apache Camel 3 Endpoint DSL. This is my code so far. It works OK. It is a test, so it is really simple. It reads from a directory and log the file content.
@Component
public class TestRoute extends EndpointRouteBuilder{
final String componentName = "file";
final String path = "/in/";
@Override
public void configure() throws Exception {
FileEndpointBuilder srcFileEndpoint = file(componentName, path);
from( srcFileEndpoint ).log(LoggingLevel.INFO, "body, ${body}");
}//configure
}//TestRoute
But when I try to change the name of the component. For instance final String componentName = "myCustomFileComponent";
I get the following error in the console
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: myCustomFileComponent:///in/ due to: No component found with scheme: myCustomFileComponent
From here, I understand I can provide custom names for the endpoints, myWMQ and myAMQ in the example. For instance the route reads from a directory and writes to another, and I would like each component to be configured in different ways. But if I specify a custom componentName, I get the error. Because it does not find the custonName component.
I do not know if it is relevant, but the code is inside a Spring Boot project
- Apache Camel version 3.4.0 Spring Boot version 2.3.1