Last active
August 29, 2015 14:27
-
-
Save rsogo/3d61d5408a93a407602f to your computer and use it in GitHub Desktop.
[Mule] エラーハンドリング・サンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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