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

Claus Ibsen commented on CAMEL-21641:
-------------------------------------

Here is a suggested how this can be done from within the RouteBuilder class 
inside the configure method with a new lambda style

 
{code:java}
import org.apache.camel.component.kserve.KServeComponent;

public class camel_kserve extends org.apache.camel.builder.RouteBuilder {

    static final String TARGET = "localhost:8001";
    static final String MODEL_NAME = "simple";    @Override

    public void configure() throws Exception {
        configure(KServeComponent.class, k -> {
            k.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
>            Assignee: 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