[ 
https://issues.apache.org/jira/browse/CAMEL-21641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17916000#comment-17916000
 ] 

Tadayoshi Sato commented on CAMEL-21641:
----------------------------------------

Just a background. When I tried to use this code with {{camel export}} it 
failed. I learned that we should not use the coding configuration for 
components used in a Java route. There should be some documentation that tells 
the limitation and best practices.
{code:java}
public class camel_kserve extends RouteBuilder {
    static final String TARGET = "localhost:8001";
    static final String MODEL_NAME = "simple";

    @Override
    public void configure() throws Exception {
        var kserve = getCamelContext().getComponent("kserve", 
KServeComponent.class);
        kserve.getConfiguration().setTarget(TARGET);

        from("timer:kserve?repeatCount=1")
            .toF("kserve:model/metadata?modelName=%s", MODEL_NAME)
            .log("${body}");
    }
}
{code}

> camel-jbang - Configuring components in Java DSL best practice
> --------------------------------------------------------------
>
>                 Key: CAMEL-21641
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21641
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Priority: Major
>             Fix For: 4.x
>
>
> You should not have component configuration code in the configure() method as 
> this is for the DSL only.
> We should have a practice where to put such code, also for users that want to 
> cramp all together in a single file for fun and demo purposes.
> So we may have a optional method on RouteBuilder for this purpose. That is 
> triggered by camel-core and is only intended for configuration of components 
> and others that you may otherwise do in application.properties
>  



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

Reply via email to