Redhat JBoss Fuse和Apache Camel-如何使用3个文件嵌套XML?

时间:2019-02-25 08:14:38

标签: apache-camel jbossfuse

我正在尝试在具有3个级别的xml文件中调用route 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>

我的第二个文件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">
        <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>

我的第三个文件File0B01.xml

<?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:端点上没有可用的使用者:Endpoint [direct:// routeNested0B01]

我应该如何解决此问题?

0 个答案:

没有答案