【问题标题】:Mule ESB + TOMCAT Web Application IntegrationMule ESB + TOMCAT Web 应用程序集成
【发布时间】:2015-02-11 10:33:10
【问题描述】:

我有一个在 Tomcat 服务器上执行 CRUD 操作的 Spring MVC Web 应用程序。我可以在 Tomcat 之前使用 Mule ESB 作为请求处理程序吗?例如,用户请求 localhost:8181/user/create(Mule ESB 端口)和 Mule 重定向请求到 localhost:8080/user/create(Tomcat 服务器端口)并通过 mule 发送回响应。我正在将 Mule ESB 用于 Web 服务,但我不明白如何将 Mule ESB 用于 Web 应用程序请求。

【问题讨论】:

    标签: java tomcat mule esb


    【解决方案1】:

    您可以使用 3.6 中发布的新 HTTP 模块并使用此流程创建代理:

    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:http="http://www.mulesoft.org/schema/mule/http"
          xsi:schemaLocation="
                   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">
    
        <http:listener-config name="proxyConfig" host="localhost" port="${proxyPort}" />
        <http:request-config name="requestConfig" host="localhost" port="${httpPort}" />
        <flow name="proxyTemplate">
            <http:listener config-ref="proxyConfig" path="/*" responseStreamingMode="AUTO" parseRequest="false" >
                <http:response-builder statusCode="#[message.inboundProperties['http.status']]" reasonPhrase="#[message.inboundProperties['http.reason']]" />
            </http:listener>
    
            <copy-properties propertyName="*" />
            <remove-property propertyName="http.*" />
            <copy-attachments attachmentName="*" />
    
            <set-property propertyName="X-Forwarded-For" value="#[message.inboundProperties['http.remote.address']]" />
    
            <http:request config-ref="requestConfig" method="#[message.inboundProperties['http.method']]" path="#[message.inboundProperties['http.request.path']]" parseResponse="false" >
                <http:request-builder>
                    <http:query-params expression="#[message.inboundProperties['http.query.params']]" />
                </http:request-builder>
            </http:request>
    
            <copy-properties propertyName="*" />
            <remove-property propertyName="http.*" />
            <copy-attachments attachmentName="*" />
        </flow>
    
    </mule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-17
      • 1970-01-01
      • 1970-01-01
      • 2013-05-23
      • 2014-09-10
      • 2012-02-24
      相关资源
      最近更新 更多