java - 无法解析 Apache Camel Route 中的 .process

标签 java apache apache-camel

我正在尝试使用 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/

相关文章:

java - log4j 如何在java代码中设置FileAppender编码?

java - 使用 StringBuffer 构建更高效的 SQL 插入

java - 使用camel聚合器接收多封电子邮件时遇到问题

java - Camel : How to once insert data into DB table if only all xmls are valid?

java - 如何找到 Xpath 并为 Camel 中的标签添加值

java - 在本地而非远程收集 Tomcat 统计信息

java - 哪种数据结构? LinkedList 还是 Java 中的任何其他?

apache - 过滤 access.log 以返回唯一 IP 地址列表和每个客户端的成功请求数(代码 200)的有效方法是什么?

python - 请求 header 中的 Wsgi 自定义字段

通过DOD PKI CAC进行Apache身份验证