WSO2 API Manager 4.5.0 – Out Flow mediation sequence not triggered when Response Caching is enabled
07:21 21 Oct 2025

Everything works fine, caching is active and responses are served from cache. However, when the response is served from cache (cache hit), the Out Flow (response flow) doesn’t execute at all — meaning any mediations like:

… are not triggered.

What I’ve observed

  • On the first request (cache miss): Out Flow works normally. Response is logged, transformed, etc.
  • On subsequent cached requests: The APIResponseCacheHandler serves the response directly. The Synapse mediation engine (Out Flow) is bypassed. No mediation or logging happens. Even carbon.log shows no response-level activity.

What I’ve tried

  1. Custom Cache Mediator (collector=true/false): Works, but only when caching manually. When response comes from cache, Out Sequence is skipped.

  2. force_message_building=true in deployment.toml: No effect. The response caching still bypasses mediation.

  3. Custom In/Out Sequences: Works only for non-cached responses.

Goal

I need to:

  • Keep Response Caching enabled (built-in WSO2 mechanism)

  • And still be able to execute some logic after the response is served — for example:

  • Convert XML → JSON before sending to the client

  • Log cached responses

Since Out Flow does not trigger for cached responses, I need an alternative way to handle or modify the cached response before it’s returned to the client.

caching wso2 wso2-api-manager