Version: 17.07
Supported Since: 17.07
Cache processor can be used as a response cacher. A key - value pair is needed for the cache processor and hash key will be extracted from the message context using two methods
If Etag is there, Etag will be used as the hash key.
If Etag is not there message payload will be used as the hash key.
Cache processor checks the hash key in the cache and returns value if available. If key does not exist in the cache, response will be added to the cache as a new entry.
Next if a cache miss |
If hash key does not exist, current message context will be forwarded to this outport |
Next if a cache hit |
If hash key exists, the processing element will update the payload and it will be forwarded to this outport |
On Exception |
The message context will be sent to this outport if any exception occurred while adding the scope variable |
Cache Name |
Basic |
Name of the cache manager. Cache manager should not be created with the same name already present. |
Heap Size |
Basic |
Defines the heap size(in MB) of the cache. |
Expiry time |
Basic |
Cache mappings will expire after a fixed duration following their creation and that time(in Minutes) is defined by this variable. |
Digest Algorithm |
Basic |
Defines the hash generation algorithm. Supported algorithms are as follows
|
Normalize the payload before caching if possiblelgorithm |
Basic |
If this is checked payload will be normalized before generating the hash. |
In the following use case, cache processing element is used to cache reponse message payload. Here to demonstrate the caching operation, NIO HTTP Ingress Connector and NIO HTTP Egress Connector is used. Complete flow for the use case is shown below. Since no parameter is mandatory you can test the flow without setting any.
Now run your integration flow and send a request message to the configured request URL to test your integration flow. Cache processor will cache the reponse. So when the same request comes for the second time, cache processor will give the cached response. So intergration flow will not go to NIO HTTP Egress Connector.