使用相同端口使用Mule创建两个应用程序

时间:2015-01-21 20:05:40

标签: mule

如何将此代码拆分为两个Mule应用程序,或者这是否可能?

<flow name="service1" doc:name="service1">
    <inbound-endpoint 
        exchange-pattern="request-response" 
        address="http://localhost/services/service1" 
        doc:name="HTTP">
    </inbound-endpoint>

    <outbound-endpoint 
        address="http://remotelocal/services/service1" 
        exchange-pattern="request-response" 
        doc:name="Generic">
    </outbound-endpoint>
</flow>

<flow name="service2" doc:name="service2">
    <inbound-endpoint 
        exchange-pattern="request-response" 
        address="http://localhost/services/service2" 
        doc:name="HTTP">
    </inbound-endpoint>

    <outbound-endpoint 
        address="http://remotelocal/services/service2" 
        exchange-pattern="request-response" 
        doc:name="Generic">
    </outbound-endpoint>
</flow>

我试图将其拆分为两个应用程序,但它给我一个端口冲突错误。

Mule版本:3.4和3.5,共享资源。

1 个答案:

答案 0 :(得分:3)

尝试这样的域名:

<?xml version="1.0" encoding="UTF-8"?>
<domain:mule-domain
        xmlns="http://www.mulesoft.org/schema/mule/core"
        xmlns:domain="http://www.mulesoft.org/schema/mule/domain"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:spring="http://www.springframework.org/schema/beans"
        xmlns:http="http://www.mulesoft.org/schema/mule/http"
        xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
        xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
               http://www.mulesoft.org/schema/mule/domain http://www.mulesoft.org/schema/mule/domain/current/mule-domain.xsd
               http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
               <http:connector name="SharedHttp"/>
</domain:mule-domain>

像这样的App A:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0"
    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-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">

    <flow name="myappFlow">
        <http:inbound-endpoint connector-ref="SharedHttp" host="localhost" port="8081" />
        <logger message="APP A" level="ERROR"/>
    </flow>

</mule>

像这样的应用B:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0"
    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-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">

    <flow name="myappFlow">
        <http:inbound-endpoint connector-ref="SharedHttp" host="localhost" port="8081" path="b" />
        <logger message="APP B" level="ERROR"/>
    </flow>

</mule>
相关问题