第一次使用Mule。我有下面列出的流程,它试图每隔15秒将参数发布到一个URL。
我认为必须将URL参数定义为有效负载,例如
Mule ESB - How to call a API via HTTP POST method (sending parameters along)
<set-payload value="#[['xxx':'yyy']]"/>
但是当我使用如下的poll元素时,我找不到放置它的位置。我在它的当前位置得到的错误是
从元素'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>
答案 0 :(得分:1)
您需要在出站端点之前设置有效负载。然而,民意调查仅排除了一个消息处理器,因此需要使用processor-chain
或sub-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>