Iam trying create a simple scenario where Populate cache stores request query param into cache and populate cache to retrieve to from cache,finally AM -AssignMessage policy to display the final response.
Proxy.xml:
<ProxyEndpoint name="default">
<Description/> <FaultRules/>
<PreFlow name="PreFlow">
<Request>
<Step>
<Name>Populate-Cache-1</Name>
</Step>
<Step> <Name>Lookup-Cache-1</Name>
</Step> </Request> <Response/>
</PreFlow>
<PostFlow name="PostFlow">
<Request/> <Response>
<Step> <Name>Assign-Message-1</Name> </Step>
</Response> </PostFlow> <Flows/> <HTTPProxyConnection> <BasePath>/pc-populatecachepolicysample</BasePath> <Properties/> <VirtualHost>default</VirtualHost> </HTTPProxyConnection> <RouteRule name="noroute"/> </ProxyEndpoint>
Populate-Cache-1:
<PopulateCache async="false" continueOnError="false" enabled="true" name="Populate-Cache-1">
<DisplayName>Populate Cache-1</DisplayName>
<Properties/>
<Source>request.queryparam</Source>
<CacheKey>rpath</CacheKey>
<!--<Prefix>ReqPath</Prefix>
<KeyFragment>rpath</KeyFragment>
<KeyFragment ref="request.path"/>-->
<Scope>Global</Scope> <ExpirySettings> <TimeoutInSec>3600</TimeoutInSec> </ExpirySettings>
</PopulateCache>
Lookup-Cache-1
<LookupCache async="false" continueOnError="false" enabled="true" name="Lookup-Cache-1">
<DisplayName>Lookup Cache-1</DisplayName> <Properties/> <CacheKey>rpath</CacheKey>
<Scope>Global</Scope>
<AssignTo>flowVar</AssignTo>
</LookupCache>
Assign Message-1:
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message-1">
<DisplayName>Assign Message-1</DisplayName> <Properties/>
<Set> <Payload contentType="text/xml"> <root> <Countryname>{flowVar}</Countryname> </root> </Payload> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="response"/> </AssignMessage>
Could you please suggest me ,if there is code issue.Or do I need to create my own cache
See an example here that shows basic populate & lookup cache. Hope it helps.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |