我正在尝试使用 Apache Camel 公开 REST 端点。我试图引入使用处理器来处理传入消息的管理,但是当我尝试使用 .process()
时,IntelliJ 提示该方法无法解析。
我的代码如下所示:
public void configure() throws Exception {
restConfiguration()
.host(host).port(port);
rest("/exampleCallback").description("ExampleCallBackUri")
.get()
.bindingMode(RestBindingMode.off)
.param().name(abc).type(RestParamType.query).required(true).endParam()
.param().name(xyz).type(RestParamType.query).required(true).endParam()
.produces(MediaType.TEXT_PLAIN_VALUE)
.process(messageProcessor).id("MessageProcessor")
.to(exampleEndpoint);
}
最佳答案
你需要这样做,
rest("/exampleCallback").description("ExampleCallBackUri")
.get()
.bindingMode(RestBindingMode.off)
.param().name(abc).type(RestParamType.query).required(true).endParam()
.param().name(xyz).type(RestParamType.query).required(true).endParam()
.produces(MediaType.TEXT_PLAIN_VALUE)
.toD("someIntermediateEndpoint");
from("someIntermediateEndpoint")
.process(messageProcessor).id("MessageProcessor")
.to(exampleEndpoint);
因为RestDefinition
没有process
方法。
关于java - 无法解析 Apache Camel Route 中的 .process,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49736090/