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/3d61d5408a93a407602f to your computer and use it in GitHub Desktop.
Save rsogo/3d61d5408a93a407602f to your computer and use it in GitHub Desktop.
[Mule] エラーハンドリング・サンプル
<flow name="GetFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="Recieve HTTP request" allowedMethods="GET">
<http:response-builder reasonPhrase="#[flowVars['reason']]" statusCode="#[flowVars['statusCode']]"/>
</http:listener>
<db:select config-ref="Oracle_Configuration" doc:name="Perform a query in Database">
<db:dynamic-query><![CDATA[select NAME, VALUE from TEST
where NAME = #[message.inboundProperties['name']]></db:dynamic-query>
</db:select>
<json:object-to-json-transformer doc:name="Convert Object to JSON"/>
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy doc:name="Catch Exception Strategy"
when="#[exception.causedBy(org.mule.module.db.internal.domain.connection.ConnectionCreationException)]">
<set-variable variableName="statusCode" value="500" doc:name="Set status code"/>
<set-variable variableName="reason" value="Internal Server Error" doc:name="Set reason phrase"/>
</catch-exception-strategy>
<catch-exception-strategy doc:name="Catch Exception Strategy"
when="#[exception.causedBy(java.sql.SQLSyntaxErrorException)]">
<set-variable variableName="statusCode" value="400" doc:name="Set status code"/>
<set-variable variableName="reason" value="Bad Request" doc:name="Set reason phrase"/>
</catch-exception-strategy>
</choice-exception-strategy>
</flow>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment