0
votes

I have a Oracle database view containing details of around 8000 employees. I need to populate employee search suggestions from that view. I'm planning to use WSO2 DSS/ DSS+ESB to create a data service for that. Rather querying the view for each and every service call, i'm thinking of caching the whole view in DSS/ESB and query the cache for all the filter queries("like", "where" queries) until cache expires.

Is there any possibilities around ESB/DSS related to the above scenario?

Thanks in advance.

1

1 Answers

1
votes

You can use cache mediator with WSO2 ESB :

<proxy xmlns="http://ws.apache.org/ns/synapse" name="Test" transports="https http" startOnLoad="true" trace="disable">
    <description/>
    <target>
        <inSequence>
            <cache id="someCache" scope="per-host" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="10">
                <onCacheHit>
                    <log level="custom">
                        <property name="debug" value="incache"/>
                    </log>
                    <header name='To' action="remove"/>
                    <send/> <!-- send back previous reponse, outSequence will not be executed -->
                </onCacheHit>
                <implementation type="memory" maxSize="1000"/>
            </cache>
            <send> <!-- Current request (hash) has not been found in the cache -->
                <endpoint>
                    <address uri="http://myhost:8080/myapp/MyService"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <cache id="someCache" scope="per-host" collector="true"/> <!-- Add this response to the cache -->
            <log level="custom">
                <property name="debug" value="outseq"/>
            </log>
            <send/>
        </outSequence>
    </target>
</proxy>

Inside the inSequence, if current request exists in the cache, 'onCacheHit' mediation will be executed with previous response. Otherwise, the 'send' to the endpoint will be executed

Inside outSequence, you add the response to the cache