Apache camel Redhat JBoss保险丝和;ApacheCamel-嵌套如何使用3个文件路由XML?

Apache camel Redhat JBoss保险丝和;ApacheCamel-嵌套如何使用3个文件路由XML?,apache-camel,jbossfuse,Apache Camel,Jbossfuse,我尝试在一个xml文件中调用route,有3个级别 1) 首先,可以无限制地调用嵌套路由吗 2) 这是我的例子: 我的第一个文件调用RootFile01.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Configures the Camel Context --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="htt

我尝试在一个xml文件中调用route,有3个级别 1) 首先,可以无限制地调用嵌套路由吗

2) 这是我的例子: 我的第一个文件调用RootFile01.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context -->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="  http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd          http://camel.apache.org/schema/spring   http://camel.apache.org/schema/spring/camel-spring.xsd">
    <!-- Import Framework. -->
    <import resource="classpath*:META-INF/spring/camel-context-framework*.xml"/>
    <import resource="File0A01.xml"/>


    <import resource="File0B01.xml"/>


    <camelContext id="camelContext-db465ea3-e2da-4931-8902-0c771d2eac3c" xmlns="http://camel.apache.org/schema/spring">
        <routeContextRef ref="routeContextNested0A01"/>
        <routeContextRef ref="routeContextNested0B01"/>
        <route handleFault="true" id="_route1">
            <from id="_from1" uri="coveo-soap://test"/>
            <recipientList id="_recipientList1">
                <method ref="soapDynamicRouter"/>
            </recipientList>
        </route>
    </camelContext>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context -->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="  http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd          http://camel.apache.org/schema/spring   http://camel.apache.org/schema/spring/camel-spring.xsd">
        <routeContext id="routeContextNested0A01"
        xmlns="http://camel.apache.org/schema/spring">

        <route handleFault="true" id="routeNested0A01">
            <from uri="direct://Nested0A01" />

            <log message="=Data In ${body}"></log>

            <to uri="direct://routeNested0B01" />

        </route>

    </routeContext>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <routeContext id="routeContextNested0B01"
        xmlns="http://camel.apache.org/schema/spring"> 
        <route id="routeNested0B01">
            <from uri="direct://routeNested0B01"/>

            <log message="Data In - ${body}"></log>

        </route>
    </routeContext>
</beans>

我的第二个文件File0A01.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context -->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="  http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd          http://camel.apache.org/schema/spring   http://camel.apache.org/schema/spring/camel-spring.xsd">
    <!-- Import Framework. -->
    <import resource="classpath*:META-INF/spring/camel-context-framework*.xml"/>
    <import resource="File0A01.xml"/>


    <import resource="File0B01.xml"/>


    <camelContext id="camelContext-db465ea3-e2da-4931-8902-0c771d2eac3c" xmlns="http://camel.apache.org/schema/spring">
        <routeContextRef ref="routeContextNested0A01"/>
        <routeContextRef ref="routeContextNested0B01"/>
        <route handleFault="true" id="_route1">
            <from id="_from1" uri="coveo-soap://test"/>
            <recipientList id="_recipientList1">
                <method ref="soapDynamicRouter"/>
            </recipientList>
        </route>
    </camelContext>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context -->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="  http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd          http://camel.apache.org/schema/spring   http://camel.apache.org/schema/spring/camel-spring.xsd">
        <routeContext id="routeContextNested0A01"
        xmlns="http://camel.apache.org/schema/spring">

        <route handleFault="true" id="routeNested0A01">
            <from uri="direct://Nested0A01" />

            <log message="=Data In ${body}"></log>

            <to uri="direct://routeNested0B01" />

        </route>

    </routeContext>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <routeContext id="routeContextNested0B01"
        xmlns="http://camel.apache.org/schema/spring"> 
        <route id="routeNested0B01">
            <from uri="direct://routeNested0B01"/>

            <log message="Data In - ${body}"></log>

        </route>
    </routeContext>
</beans>

我的第三个文件File0B01.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context -->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="  http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd          http://camel.apache.org/schema/spring   http://camel.apache.org/schema/spring/camel-spring.xsd">
    <!-- Import Framework. -->
    <import resource="classpath*:META-INF/spring/camel-context-framework*.xml"/>
    <import resource="File0A01.xml"/>


    <import resource="File0B01.xml"/>


    <camelContext id="camelContext-db465ea3-e2da-4931-8902-0c771d2eac3c" xmlns="http://camel.apache.org/schema/spring">
        <routeContextRef ref="routeContextNested0A01"/>
        <routeContextRef ref="routeContextNested0B01"/>
        <route handleFault="true" id="_route1">
            <from id="_from1" uri="coveo-soap://test"/>
            <recipientList id="_recipientList1">
                <method ref="soapDynamicRouter"/>
            </recipientList>
        </route>
    </camelContext>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context -->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="  http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd          http://camel.apache.org/schema/spring   http://camel.apache.org/schema/spring/camel-spring.xsd">
        <routeContext id="routeContextNested0A01"
        xmlns="http://camel.apache.org/schema/spring">

        <route handleFault="true" id="routeNested0A01">
            <from uri="direct://Nested0A01" />

            <log message="=Data In ${body}"></log>

            <to uri="direct://routeNested0B01" />

        </route>

    </routeContext>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <routeContext id="routeContextNested0B01"
        xmlns="http://camel.apache.org/schema/spring"> 
        <route id="routeNested0B01">
            <from uri="direct://routeNested0B01"/>

            <log message="Data In - ${body}"></log>

        </route>
    </routeContext>
</beans>

看起来,RootFile01.xml可以在我的第二个文件File0A01.xml中找到routeNested0A01。但是我的第二个文件File0A01.xml无法到达第三个文件File0B01.xml中的routeNested0B01

错误消息: 交付尝试后耗尽:1捕获:org.apache.camel.component.direct.DirectConsumerNotAvailableException:端点上没有可用的使用者:端点[direct://routeNested0B01]


我应该如何解决此问题?

如何在Fuse中部署和运行此功能?如果您只是将这些文件复制到deploy文件夹,那么它们是独立的,不会在同一个包中运行。您需要将其打包到单个JAR/包中,并将其作为单个单元进行部署。还要注意,在OSGi中使用SpringXML在Red Hat Fuse中是不推荐的。改用OSGiBlueprint。您也可以使用红帽客户门户获得Fuse产品的支持,他们可以比这里更快更好地提供帮助。您好,感谢您的回答和建议,我将尝试使用红帽客户门户。