Skip to content

Instantly share code, notes, and snippets.

@fganora
Created October 19, 2016 09:29
Show Gist options
  • Save fganora/b3b110de703e0be6e79a69a7ab40a1bc to your computer and use it in GitHub Desktop.
Save fganora/b3b110de703e0be6e79a69a7ab40a1bc to your computer and use it in GitHub Desktop.
Simple Mule Caching scope example
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 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"
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/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<ee:object-store-caching-strategy name="Caching_Strategy_ManagedStore" keyGenerationExpression="#[payload]" doc:name="Caching Strategy">
<managed-store storeName="managedStore" persistent="true" maxEntries="100" entryTTL="6000" expirationInterval="6000"/>
</ee:object-store-caching-strategy>
<flow name="requestbodycaching">
<http:listener config-ref="HTTP_Listener_Configuration" path="/requestbodycaching" allowedMethods="POST" doc:name="HTTP"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<ee:cache cachingStrategy-ref="Caching_Strategy_ManagedStore" filterExpression="#[payload != &quot;exclude&quot;]" doc:name="Cache">
<expression-component doc:name="Expression"><![CDATA[payload = java.util.UUID.randomUUID().toString();]]></expression-component>
</ee:cache>
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment