Spring Boot 中的 Kamelet

问题描述 投票:0回答:1

我尝试定义一个简单的kamelet并在Camel Spring Boot路线中运行它。

my-kamelet.kamelet.yaml
位于
resources/kamelets

apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: my-kamelet
spec:
  template:
    from:
      uri: timer:mykamelet?period=1000
      steps:
        - log: "Executing Kamelet scheduled job"

我的路线构建器

@Component
public class KameletRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
         from("kamelet:my-kamelet")
            .log("Executing main route");
    }
}

pom.xml

中的相关依赖
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-spring-boot-starter</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-kamelet-starter</artifactId>
        <version>${camel.version}</version>
    </dependency>

当我启动应用程序时,出现以下错误:

错误20372 --- [kamelet-poc] [restartedMain] o.s.boot.SpringApplication:应用程序运行失败

org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[From[kamelet:my-kamelet] -> [Log[Executing mai... because of No endpoint could be found for: kamelet://my-kamelet, please check your classpath contains the needed Camel component jar.

我想我错过了一些愚蠢的东西,但我无法发现什么。

java spring-boot apache-camel
1个回答
0
投票

缺少的部分是

camel-yaml-dsl
依赖

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-yaml-dsl</artifactId>
        <version>${camel.version}</version>
    </dependency>
© www.soinside.com 2019 - 2024. All rights reserved.