Hi VIraj,
Thank you for your response.
This method works, since it implement "Service Proxy" pattern.

But I want to adopt the cache in the "Service Chaining" pattern, where I
call more than one backend services in sequence, make some decisions in
between, enriching the content etc.
I want to cache only one backend service, not the full response from our
ESB sequence. So the sample provided would not work for that case.

BTW: Bhathiya offline suggested to set and reset
<property name="RESPONSE" value="true"/>
around the cache collector=true case.  should work. However, my API is REST
and hence the cache fails at the line 246.
AICU, while going through [1] the cache mediator is written assuming the
service having single backend service and it is a SOAP. I can not use the
inbuilt cache mediator[1] for REST IN->SOAP out-(Backend)>SOAP
out(backend)->....->REST Respond sequence.

I think only option I have is to write simple class mediator to achieve the
caching, since I do not need replication. however need to behave properly
at high concurrency.

[1]
https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CacheMediator.java

Cheers,
Ruwan

On Thu, Nov 19, 2015 at 3:29 AM, Viraj Senevirathne <[email protected]> wrote:

> Hi Ruwan,
>
> I was able to use the cache mediator for above scenario by using a
> separate sequence for state 2 of the use case.
>
> So If there is a cache hit, response will be taken from the memory and
> passed to the *reqCredit* Sequence.
>
> If there is no cache hit it will follow the same way and go it case 
> *PERSON_INFO_REQUEST
> *and response will be put in to the cache memory. After that it will call
> the same sequence *reqCredit. *
>
> So it will work as Expected.
>
> I have attached the new Proxy configuration and Sequence configuration.
>
> Thank you,
>
>
> On Wed, Nov 18, 2015 at 11:01 PM, Ruwan Abeykoon <[email protected]> wrote:
>
>> Hi Devs,
>> I would like to know how we can cache the Response to first service only
>> when we adopt "Service Chaining Pattern" [1]
>>
>> For example, how I can cache the response (3) only and skip (2 and 3) for
>> subsequent requests until cache timeout occurs. [2]
>>
>> As far as I can understand, Cache mediator can not be used as
>> "collector=true" can be placed only at out-sequence. We need to put the
>> response collector on "in-sequence"
>>
>> [1] https://docs.wso2.com/display/ESB481/Service+Chaining+Example
>> [2]
>> https://docs.wso2.com/download/attachments/33136352/327.png?version=1&modificationDate=1391008346000&api=v2
>>
>> --
>>
>> *Ruwan Abeykoon*
>> *Architect,*
>> *WSO2, Inc. http://wso2.com <http://wso2.com/> *
>> *lean.enterprise.middleware.*
>>
>> email: [email protected]
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Viraj Senevirathne
> Software Engineer; WSO2, Inc.
>
> Mobile : +94 71 958 0269
> Email : [email protected]
>



-- 

*Ruwan Abeykoon*
*Architect,*
*WSO2, Inc. http://wso2.com <http://wso2.com/> *
*lean.enterprise.middleware.*

email: [email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to