@arunpatidarWhat are your thoughts on the following three ideas?I would really appreciate your opinion,
1. Leveraging the request session. I am thinking of implementing a mechanism to set an attribute with that data on session. But I believe we need to understand how the current solution handles the session management. Is the site accessible for specific users, or also for anonymous ? etc
2. The in-memory cache (and this is purely my belief) can be a tricky thing and can quickly get out of hand. I think it may work well when the processing is required on one author. But when you are on multiple publishers it will be hard to have control of that data: to know which instance has what data in-memory, to trigger targeted invalidation requests for a specific cache and so on. Also in AEMaaCS things can get even more messy, because there pods can go up and down as they like, and you cannot build a monitoring tool to manage in-memory stuff. Of course, if is not required to have that level of control, then no worries there.
3. If there is a possibility to introduce (if not already exists) microservices, then we can have one in between the AEM and the third party app. It will pull the stuff from third-party, save it somewhere (relational db, or a Redis or smth), and then AEM can consume it from there. It will bring basically the data more close to the AEM app and both components can fetch it from there. This also assumes component 1's Java code can be modified and is not like an untouchable legacy thing.
1. Leveraging the request session - Data can be shared within a single page request by accessing the same request session object. However, without a mechanism to reinitialize this object, you can't guarantee its availability across multiple requests.
2. The in-memory cache (and this is purely my belief) - If you stay with a single publisher, in-memory caching will work efficiently. However, moving to different publishers resets the cache, requiring it to be repopulated. Additionally, introducing a new caching layer requires a strategy to invalidate outdated cache entries.
Note: Using this cache method is effective in cases where the page remains consistent, though different components are accessed..
3.Introducing a microservice between AEM and the third-party application could streamline data handling. This microservice can fetch data from the third party, store it (e.g., in a relational database or Redis), and allow AEM to access it as needed. While this setup might require additional resources, another approach could involve storing data in an AEM JCR node with a timestamp. This would allow data to be fetched from the third party once per publisher session and stored within AEM for reuse.