在 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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...