Skip to content

Instantly share code, notes, and snippets.

@rsogo
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsogo/68008fa324cf26b7c313 to your computer and use it in GitHub Desktop.
Save rsogo/68008fa324cf26b7c313 to your computer and use it in GitHub Desktop.
GETのQuery ParameterをForEachで回しながら、ログに出力するサンプル
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/json
http://www.mulesoft.org/schema/mule/json/current/mule-json.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/db
http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
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/ee/tracking
http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<flow name="GetFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/output_queries" doc:name="Recieve HTTP request" allowedMethods="GET">
</http:listener>
<logger doc:name="Log the payload" level="INFO" message="About to echo #[message.inboundProperties.'http.query.params']"/>
<!-- Query Parameter分ループする -->
<foreach collection="#[message.inboundProperties.'http.query.params'.entrySet()]" doc:name="For Each">
<!-- payload変数にQuery Parameterの1つ分が入っている -->
<logger doc:name="Log the payload" level="INFO" message="payload(#[counter]): #[payload]"/>
<logger doc:name="Log the payload" level="INFO" message="payload(#[counter]).key: #[payload.key]"/>
<logger doc:name="Log the payload" level="INFO" message="payload(#[counter]).value: #[payload.value]"/>
</foreach>
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment