Expand my Community achievements bar.

SOLVED

Workflows and Flush Agent

Avatar

Level 3

Hi,

 

As per my client request, they want me to create a Widget (Custom Component) that get real time APIs from the Client database. After we have gotten that API data, I want to use Workflow and Flush Agent to clear cache of that Widget (Custom Component) so that the Widget displays the latest data from the API. I want the Workflow and Flush Agent to run at 2:00PM, 2:03PM and 2:05PM everyday. 

 

I was wondering how I could go about doing that. If anyone has any tutorials and resources about how to feasibly complete the requirements mentioned above would be greatly appreciated.

Thank you

Sching

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi,


Thank you all for the solutions. All these solutions have helped us a lot with coming up with the solutions. Me and my team has been able to find the solution to work. So we created a simple workflow. Then we use Scheduler and set a CRON Expression to run at 2PM everyday and setting the path to that specific page and now we are able to achieve the outcomes we wanted.

 

Best Regards

Sching

View solution in original post

5 Replies

Avatar

Level 3

Hi @ChanuteJo 

I would recommend you to implement sling dynamic include so that particular component alone won't be cached as part of the page and always displays real time data.

https://experienceleague.adobe.com/en/docs/experience-manager-learn/foundation/development/set-up-sl...

Avatar

Level 2

Hi @ChanuteJo 

Ideally, You should not cache this component at the dispatcher level. To implement dynamic caching of a component, one of the solutions could be using Sling Dynamic Include.

However, if you want to go ahead with your solution, you can write a scheduler that can trigger the workflow and flush agent programmatically.

Regards,
Arpit Varshney

Avatar

Community Advisor

I would suggest you to consume the API data from the frontend side so that app is not cached and it will get fresh data on each request. That’s how normally we do. 
I believe file data are cached on dispatcher so you need to identify the pages on which the component is authored and you can setup a corn expression on dispatcher to execute the cache flush. This might not work if you are on AEMCaS. Sling dynamic include help but in case the request will still go to your aem server to get the api response but from front end you can avoid the backend call. Check below blog to how do a flush programmatically https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-call-flush-agent-pr...

Avatar

Community Advisor

@ChanuteJo , Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Avatar

Correct answer by
Level 3

Hi,


Thank you all for the solutions. All these solutions have helped us a lot with coming up with the solutions. Me and my team has been able to find the solution to work. So we created a simple workflow. Then we use Scheduler and set a CRON Expression to run at 2PM everyday and setting the path to that specific page and now we are able to achieve the outcomes we wanted.

 

Best Regards

Sching