Java Camel K Rest路由需要JSON编组并执行注释代码 案例1:RESTDSL示例失败

Java Camel K Rest路由需要JSON编组并执行注释代码 案例1:RESTDSL示例失败,java,rest,apache-camel,apache-camel-k,camel-rest,Java,Rest,Apache Camel,Apache Camel K,Camel Rest,我正在尝试应用中编写的示例。骆驼K的相同示例的简化版本如下所示 levent.divilioglu:camel-k-ex $ kamel run RestRoute.java --dev integration "rest-route" created Progress: integration "rest-route" in phase Initialization Condition "IntegrationPlatformAvailable

我正在尝试应用中编写的示例。骆驼K的相同示例的简化版本如下所示

levent.divilioglu:camel-k-ex $ kamel run RestRoute.java --dev
integration "rest-route" created
Progress: integration "rest-route" in phase Initialization
Condition "IntegrationPlatformAvailable" is "True" for Integration rest-route: default/camel-k
Progress: integration "rest-route" in phase Building Kit
Integration rest-route in phase "Initialization"
Condition "IntegrationPlatformAvailable" is "True" for Integration rest-route: default/camel-k
Integration rest-route in phase "Building Kit"
Condition "IntegrationKitAvailable" is "False" for Integration rest-route: creating a new integration kit
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Integration Kit) changed phase to "Build Submitted"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Integration Kit) changed phase to "Build Running"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 1 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 5 of 5)
Progress: integration "rest-route" in phase Error
Error: integration "rest-route" deployment failed
import org.apache.camel.builder.RouteBuilder;
公共类重新路由扩展RouteBuilder{
@凌驾
public void configure()引发异常{
//剩余端点
其余(“/状态”)
.get(“/hello”).to(“direct:hello”);
//路线
来自(“直接:你好”)
.transform().constant(“Hello World”);
}
}
然后,构建失败,如下所示

levent.divilioglu:camel-k-ex $ kamel run RestRoute.java --dev
integration "rest-route" created
Progress: integration "rest-route" in phase Initialization
Condition "IntegrationPlatformAvailable" is "True" for Integration rest-route: default/camel-k
Progress: integration "rest-route" in phase Building Kit
Integration rest-route in phase "Initialization"
Condition "IntegrationPlatformAvailable" is "True" for Integration rest-route: default/camel-k
Integration rest-route in phase "Building Kit"
Condition "IntegrationKitAvailable" is "False" for Integration rest-route: creating a new integration kit
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Integration Kit) changed phase to "Build Submitted"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Integration Kit) changed phase to "Build Running"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed"
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 1 of 5)
Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 1 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 2 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 3 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Scheduling" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Pending" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Running" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Failed" (recovery 4 of 5)
(combined from similar events): Integration rest-route subresource kit-c2o28iiqfl2hcn198ng0 (Build) changed phase to "Initialization" (recovery 5 of 5)
Progress: integration "rest-route" in phase Error
Error: integration "rest-route" deployment failed
当我看到日志停止后,我看到它挂在上面,如下图所示

levent.divilioglu:camel-k-ex $ kamel get
NAME        PHASE   KIT
rest-route  Error   default/kit-c2o28iiqfl2hcn198ng0
B-案例2:如果添加了Json编组,Rest DSL示例将起作用 然后我通过应用
kamel delete rest-route
进行删除,然后在直接路由的末尾添加一个单独的
marshal().json
,从
kamel run RestRoute.java--dev
开始,它就可以工作了

import org.apache.camel.builder.RouteBuilder;
公共类重新路由扩展RouteBuilder{
@凌驾
public void configure()引发异常{
//剩余端点
其余(“/状态”)
.get(/hello)至(“director:hello”);
//路线
来自(“直接:你好”)
.transform().constant(“Hello World”)
.marshal().json();
}
}
C-案例3:路由与注释Json编组一起工作 最有趣和奇怪的行为就是这个案例。我注释掉
marshal().json()
行,它继续工作。然而,即使我删除了这条注释行,它也不会工作。因此,工作示例如下所示

import org.apache.camel.builder.RouteBuilder;
公共类重新路由扩展RouteBuilder{
@凌驾
public void configure()引发异常{
//剩余端点
其余(“/状态”)
.get(“/hello”).to(“direct:hello”);
//路线
来自(“直接:你好”)
.transform().constant(“Hello World”);
//.marshal().json()
}
}
D版本 MiniKube版本

minikube version: v1.17.1
commit: 043bdca07e54ab6e4fc0457e3064048f34133d7e
ApacheCamelk版本

Apache Camel K Runtime 1.7.0
camelk客户端版本

Camel K Client 1.4.0
E-调查结果和问题 我哪里做错了?我刚刚使用了apache官方网站上给出的示例。有趣的事情是

  • 该示例本身不起作用,但任何rest路由都需要JSON编组,即使内容是简单的文本
  • 注释行似乎在集成文件中执行

这是一个错误,还是官方文件中有问题?

你能把操作员的日志包括进来吗?@LucaBurgazzoli操作员日志不小,它很大,很难用一个小问题格式化。这里需要它吗?我的意思是这是一个功能方面的问题。但也许最好将日志添加到github,因为我已经打开了一个问题,我怀疑这是一个bug;如果您在问题链接中询问,我将在那里添加日志;它闻起来像个bug,但可能是关于操作员如何创建容器和部署的,所以有一些日志可能会有所帮助。请将它们(或摘录)添加到githubissue@LucaBurgazzoli我刚刚将终端输出和Camel K操作员日志添加到问题中,检查链接: