use of org.wso2.caching.CacheConfiguration in project wso2-synapse by wso2.
the class CacheMessageBuilderDispatchandler method invoke.
@Override
public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {
InvocationResponse invocationResponse = super.invoke(messageContext);
EndpointReference toEPR = messageContext.getTo();
Pipe pipe = (Pipe) messageContext.getProperty(PassThroughConstants.PASS_THROUGH_PIPE);
if (pipe != null && messageContext.getAxisMessage() != null) {
CacheConfiguration cacheCfg = null;
Parameter ccfgParam = messageContext.getAxisMessage().getParameter(CachingConstants.CACHE_CONFIGURATION);
if (ccfgParam != null && ccfgParam.getValue() instanceof CacheConfiguration) {
cacheCfg = (CacheConfiguration) ccfgParam.getValue();
// even though we found a cache config, if the timeout is <= 0, caching is disabled
if (cacheCfg.getTimeout() <= 0) {
return invocationResponse;
}
try {
RelayUtils.buildMessage(messageContext, false);
} catch (Exception e) {
log.error("Error while executing the message at cache message builder handler", e);
}
}
}
return invocationResponse;
}
Aggregations