我的路线如下所示 -
@Override
public void configure() throws Exception {
from("kafka:adapterTopic")
.to("rest://post:gatewayinbound-dev11.devsite.com");
}
我也试过这个,
.to("rest:post:gatewayinbound-dev11.devsite.com");
还有这个,
restConfigutation().host("gatewayinbound-dev11.devsite.com");
from("kafka:adapterTopic")
.to("rest:post:provideStatus/");
我已经尝试过camel-rest-starter
在类路径中使用依赖项,也没有尝试使用它。
我试过把camel-rest
而不是camel-rest-starter
放在pom中。
但是没有什么能让异常消失,下面是堆栈跟踪-
{"timestamp":"2020-04-21 18:17:45.327","severity":"ERROR","class":"org.springframework.boot.SpringApplication","crId":"","msg":"Application run failed","exception":"org.apache.camel.RuntimeCamelException","cause":"org.apache.camel.FailedToCreateRouteException: Failed to create route route10 at: >>> To[rest:post:gatewayinbound-dev11.devsite.com] <<< in route: Route(route10)[[From[kafka:adapterTopic]] -> [To[rest:... because of Failed to resolve endpoint: rest:\/\/post:gatewayinbound-dev11.devsite.com due to: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rest-configuration' defined in class path resource [org\/apache\/camel\/model\/rest\/springboot\/RestConfigurationDefinitionAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.spi.RestConfiguration]: Factory method 'configureRestConfigurationDefinition' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot configure option [useXForwardHeaders] with value [true] as the bean class [org.apache.camel.spi.RestConfiguration] has no suitable setter method, or not possible to lookup a bean with the id [true] in Spring Boot registry"
请在这里帮助我。查看 Camel 网站上的示例,配置休息生产者端点看起来很容易,但对我来说却非常困难。
编辑-
由于 Rest 组件是 camel-core 的一部分,我使用的是camel-core-2.22.1。
然后按照 Raúl Cancino 的建议,我也尝试了这个-
to("rest:post:provideStatus?host=gatewayinbound-dev11.devsite.com:443")