AEM system architecture solution
Hi everybody.
My today’s issue is regarding an architectural decision that our team had to make having two option in front (maybe you guys see more…so please advice).
To start from the beginning, we had develop an AEM project (with Java backend and Angular frontend) and deployed it in one Author instance. So we had a .core, a .apps and a content Java projects in Eclipse (standard projects for AEM) and we used Maven to build and deploy them into AEM. The Angular code was making Ajax calls to Sling Servlets, which in turn were calling other classes where all the business logic was stored. The project was only a demo, so we didn’t pay attention to everything that a production ready application may require. Everything worked like a charm. La vita e bella.
Now, we need to enhance the demo version and make it good enough to be deployed in production, live. The challenge we are facing now refers to the fact that we need to use multiple Publish instances and an Author instance (so not only an Author like in demo). Therefore we need to think of a way to split the entire code we have among those instances. So we thought that Publish should be as light as possible, but can’t avoid 100% to not have any of our code deployed to it. We thought that is best to keep the Angular code deployed only on Publish instances and then establish how to split the Java code too. So, for the Java part we thought to have only few services (maybe even only one) deployed on Publish instances, which would not do any business logic. And the rest of Java services to be deployed on Author. The idea was to have the Java code from Publish instances only routing requests coming from browser (from Angular) to Java code from Author. But the main problem is that we can’t decide for best approach to achieve this routing, this communication.
For simplicity lets assume we have service A deployed on Publish and service B deployed on Author (when I say service I don’t necessary mean service in AEM, but as a general concept).
So basically we thought of two ways:
1. We make REST calls from Publish instances to Author, but do not know if it is right to do so. We do not know if Adobe will block the REST calls from Publish instances to Author or if it can allow it.
2. We use Reverse Replication, which Adobe is recommending. But as far as I know this refers to data exchange while we need to achieve a communication via network. So in order for a A to be able to make B run I think we must some how simulate a normal network communication protocol but this time making use of AEM data and Reverse Replication functionality. Some how adding content to Publish outbox and having the Reverse Replication Agents (on Publish and on Author) configured would be equivalent to sending a HTTP request via network. Because Reverse Replication Agent will take care to move data from Publish on Author. Then we could have a Listener on data on Author that could invoke service B once data was updated.
A real life scenario:
We have a field in web page , where user can enter a value. That value must be uniquely chosen among users (like an account id for example). For that our Angular app is doing a real time Ajax call to service A. Service A has to find out from service B if that value is unique. Service B has to lookup among the values he has in memory. The list of values must be on Author, not on Publish.
So, questions time (prepare yourself):
1. We had several thoughts and assumptions, until we got to the point were decided to split the code. Are they right? Should we have followed an entirely other logic path?
2. Is it that bad to use REST calls between Publish and Author? Are there any AEM configs that we need to take care of?
3. Did we understood well how to use Reverse Replication for our needs? Is it suitable to use it?
4. Is there anything else that slips our attention or we should take into account?
5. Are there any other possible solutions/approaches?
6. How is in general a project achieving that? (because it strikes me that I didn’t found any articles on this trivial, at least at first sight, topic on the internet)
Thank you very much for having the patience to read this and I really hope you can give me some directions