Hi ,
I have a custom component on page in which i am calling third party web service to pull the data. Requirement in this case is to serve the data from dispatcher cache every time user access the configured pages (cached data pulled from web service) but update the cache in regular intervals of time so that data is up-to date (update data/flush cache once in two hours for the pages that are configured with this specific component)
Could you please help me out in achieving this ?
Thanks,
Hari
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
you can trigger dispatcher invalidation whenever your webservice received new data. To achieve this, your code on publish needs to get the "Replicator" service and there use the "replicate" method and provide a custom agentFilter, which you can set in the ReplicationOptions. In teh agentFilter you can select which agent is actually triggered; in your case you need to select the "invalidate" agent (or whatever name this agent has on your system; instead of that you could also implement the selection based on the serialization type, which is a bit more code to write). See the API documentation for details.
kind regards,
Jörg
Views
Replies
Total Likes
Hi,
you can trigger dispatcher invalidation whenever your webservice received new data. To achieve this, your code on publish needs to get the "Replicator" service and there use the "replicate" method and provide a custom agentFilter, which you can set in the ReplicationOptions. In teh agentFilter you can select which agent is actually triggered; in your case you need to select the "invalidate" agent (or whatever name this agent has on your system; instead of that you could also implement the selection based on the serialization type, which is a bit more code to write). See the API documentation for details.
kind regards,
Jörg
Views
Replies
Total Likes
I would suggest avoid caching the content on dispatcher and rather store webservice response under your repository, somewhere under /content or /etc.
For your component all the time reference point for data would be the repository location where you are storing the content and not webservice directly.
Now 2nd part is to regularly update the data in repository. For this requirement you can either use a scheduler OSGI service or Custom Importer, responsibility of these importer/scheduler would be to refresh the webservice content in repository.
With above approach even if your webservice goes down, still you will have reference data in repository to show on component.
-- Runal
Views
Replies
Total Likes
Here are the Dispatcher config docs:
https://docs.adobe.com/docs/en/dispatcher/disp-config.html
I will get Dispatcher experts to look at this tomorrow if you need more help.
Views
Replies
Total Likes
Thanks for the config document,
I have looked into configurations but couldn't see any option to configure for my scenario/requirement. Could you please ask dispatcher experts to look into and suggest how i can achieve this either dispatcher rules or custom code ?
Thanks a lot for your help!
Views
Replies
Total Likes
Hi ,
Thanks for your reply.
I got the point but what actually i am trying to avoid is calling web service every time on page hit. If we have to call invalidate on data change from web service- that means , we need to call web service on load of every page.
Please let me know your thoughts.
Thanks,
hari
Views
Replies
Total Likes
Hi,
you have 2 options here:
These are the options I see.
kind regards,
Jörg
Views
Replies
Total Likes
One approach here would be to have a separate caching mechanism which will cache the web-service responses for you. The custom component can then look up to this cache for data before calling the web-service. You can explore the various caching technologies to check which best suit your need
Dispatcher is best used for caching the final html response from the content server rather than specific web-service responses used to build the html response.
Regards,
Kunal
Views
Replies
Total Likes
Thanks a lot for information.
Web service data is independent of end user but it depends on page (data we pulled in component based on few parameters (which are inputs to web service call
))
Any thoughts ?
Views
Replies
Total Likes