如何解决在 micronaut 上运行 apache camel cxf 路由
我们正在尝试在 micronaut 运行时部署骆驼路由,但无法通过 Micronaut.run()
启动路由,只有服务器启动。
[信息] - io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:94) - 启动在 5339 毫秒内完成。服务器运行:http://localhost:8080
您能否提供有关如何使用 Micronaut
运行骆驼路线的代码片段
public class processreserveinventory extends RouteBuilder {
@Override
public void configure() throws Exception {
final ModelCamelContext camelContext = (ModelCamelContext) getContext();
final org.apache.camel.support.DefaultRegistry registry = new org.apache.camel.support.DefaultRegistry();
((org.apache.camel.impl.DefaultCamelContext) camelContext).setRegistry(registry);
//property util bean
registry.bind("propertyBean",new beans.PropertyUtil(camelContext));
RegistryConfig.setCXFRSEndpointProperties(registry);
public interface Service_CXFRS_1 {
@javax.ws.rs.Path("")
@javax.ws.rs.POST()
@javax.ws.rs.Consumes({ "application/json" })
@javax.ws.rs.Produces({ "application/json" })
Object PostFlow(String payload);
}
CxfRsEndpoint restEP=(CxfRsEndpoint)endpoint("cxfrs://" + "/store/reserveinventory" + "?resourceClasses=package.processreserveinventory$Service_CXFRS_1"
+ "&features=#features_CXFRS_1" + "&inInterceptors=#inInterceptors_CXFRS_1"
+ "&outInterceptors=#outInterceptors_CXFRS_1" + "&properties=#properties_CXFRS_1"
+ "&cxfRsEndpointConfigurer=#endpointConfigurer_CXFRS_1" + "&providers=#providers"
+ "&loggingFeatureEnabled=true");
camelContext.setUseMDCLogging(true);
camelContext.setStreamCaching(true);
// onException block
onException(java.lang.Exception.class)
.handled(true)
.to("direct:commonException");
// Route 1 -start of rest call
from(restEP)
.recipientList()
.simple("direct:${headers.operationName}");
from("direct:PostFlow")
.log("hello world");
}
// Micronaut Application starter
public static void main(String[] args) throws Exception {
Micronaut.run(processreserveinventory.class,args);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。