0

我们正在尝试在 micronaut 运行时部署骆驼路由,但无法启动Micronaut.run()只有服务器启动的路由。

[INFO] - 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);
    } 
}
4

0 回答 0