Created
July 28, 2015 09:08
-
-
Save ricston-git/1c6fe663c0a8394cebdc to your computer and use it in GitHub Desktop.
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
<mongo:config name="mongoDb" database="testDb" host="localhost" port="27017" /> | |
<flow name="setNullComponent"> | |
<expression-transformer expression="org.mule.transport.NullPayload.getInstance()" evaluator="groovy"></expression-transformer> | |
</flow> | |
<flow name="getTestCollectionFlow"> | |
<vm:inbound-endpoint path="getTestCollection" exchange-pattern="request-response" /> | |
<!-- workaround for mongo throwing exception when it does not find an entry in the db --> | |
<first-successful> | |
<!-- try query --> | |
<mongo:find-one-object collection="testCollection" config-ref="mongoDb" query="#[string:{ "id" : #[bean:id] } ]" /> | |
<!-- if previous call throws exception, set the payload to NullPayload --> | |
<flow-ref name="setNullComponent" /> | |
</first-successful> | |
</flow> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment