[英]How to send every request to another HTTP server in Mule ESB for logging
我是Mule ESB的新手。 因此,我為Web服務代理使用了一個簡單的配置。 每次調用Web服務代理(例如Service1)時,我都需要向日志服務器發送HTTP get請求。 我怎樣才能做到這一點?
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns="http://www.mulesoft.org/schema/mule/core"
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:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/current/mule-pattern.xsd http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd http://www.mulesoft.org/schema/mule/https
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd
http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd http://www.mulesoft.org/schema/mule/pattern
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.3/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/pattern/3.3/mule-pattern.xsd http://www.mulesoft.org/schema/mule/spring-security
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.3/mule-spring-security.xsd
http://www.mulesoft.org/schema/mule/spring-security/3.3/mule-spring-security.xsd http://www.springframework.org/schema/security
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.mulesoft.org/schema/mule/ee/jdbc
http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd" version="EE-3.4.0">
<http:connector name="NoSessionConnector" doc:name="HTTP\HTTPS">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:connector>
<pattern:web-service-proxy name="Service1" >
<http:inbound-endpoint address="http://esb.local:15000/service1" />
<http:outbound-endpoint address="http://esb.test.com/service1" />
</pattern:web-service-proxy>
</mule>
謝謝米斯巴! 我正在使用第二種解決方案(路由)。
<flow name="HelloWorld" doc:name="HelloWorld">
<!--<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8888" doc:name="Http Endpoint"/>-->
<http:inbound-endpoint address="http://esb.local:8090/test.html"/>
<http:outbound-endpoint
method="GET" exchange-pattern="request-response"
address="http://www.weather.com/test.html"
contentType="text/html" doc:name="HTTP"/>
<wire-tap>
<http:outbound-endpoint address="http://logserver/index.php" exchange-pattern="one-way"/>
</wire-tap>
</flow>
嘗試使用分離器模式並指向兩個端點。
https://docs.mulesoft.com/mule-user-guide/v/3.6/splitter-flow-control-reference
或者您可以使用此工具,它會適合您的目的。
https://docs.mulesoft.com/mule-user-guide/v/3.7/routers#wiretap
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.