Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleNote

You can configure the Mediator using XML. Click on "switch to source view" in the "Mediator" window.

...

Example

In this example, the first message is sent to the endpoint specified as cache is not hit. The response will come to the Cache Mediator inside the out mediator, which caches the response. The second similar message will match the cache and the response will be directly fetched from the cache and sent to the requester. This happens because no onCacheHit sequence is defined.

Code Block
XML
XML
<definitions xmlns="http://ws.apache.org/ns/synapse">
  <in>
    <cache timeout="20" scope="per-host" collector="false"
      hashGenerator="org.wso2.caching.digest.DOMHASHGenerator">
      <implementation type="memory" maxSize="100"/>
    </cache>

    <send>
      <endpoint>
        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
      </endpoint>
    </send>
  </in>

  <out>
    <cache collector="true"/>
    <send/>
  </out>
</definitions>

...

According to this example configuration, if you define a cache collector using the cache mediator in the in sequence, you need to add the RESPONSE property to consider the message as a response message.

...

languagexml

...

Excerpt
hiddentrue

Description of the Cache Mediator in WSO2 ESB.