2014-12-08 44 views
0

第一次使用Mule。我有下面列出的流量,它正在嘗試每15秒將參數發佈到URL。用騾子發送HTTP參數使用輪詢

我搜集的URL參數必須被定義爲有效載荷,像

Mule ESB - How to call a API via HTTP POST method (sending parameters along)

<set-payload value="#[['xxx':'yyy']]"/> 

,但我無法找出如下使用輪詢元素時把這個, 。我在它當前位置得到的錯誤是

找到的元素'poll'開始的內容無效。

我已經在民意調查之前嘗試過,內部和http:outbound-endpoint。有任何想法嗎?

感謝 奧利弗

<mule xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns:email="http://www.mulesoft.org/schema/mule/email" xmlns:json="http://www.mulesoft.org/schema/mule/json" 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.5.2" 
    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 
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd 
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd 
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd"> 
    <message-properties-transformer name="Message_Properties" doc:name="Message Properties"> 
     <add-message-property key="Authorization" value="mykey"/> 
    </message-properties-transformer> 
    <flow name="testFlow2" doc:name="testFlow2"> 
    <set-payload doc:name="Set Payload" value="#[['test':'test']]"/> 
     <poll doc:name="Poll"> 
      <fixed-frequency-scheduler frequency="15" timeUnit="SECONDS"/> 
      <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://myurl.com" doc:name="HTTP" transformer-refs="Message_Properties"> 
      </http:outbound-endpoint> 
     </poll> 
     <logger level="INFO" doc:name="Logger"/> 
    </flow> 
</mule>  

回答

1

您需要出站端點前設置有效載荷。然而,輪詢僅節選一個消息處理器,以便他們需要鞋有角的使用processor-chainsub-flow或類似:

<poll doc:name="Poll"> 
      <fixed-frequency-scheduler frequency="15" 
       timeUnit="SECONDS" /> 
      <processor-chain> 
       <set-payload value="#[['xxx':'yyy']]" /> 
       <http:outbound-endpoint exchange-pattern="request-response" 
        method="POST" address="http://myurl.com" doc:name="HTTP" 
        transformer-refs="Message_Properties"> 
       </http:outbound-endpoint> 
      </processor-chain> 
     </poll>