Solved
AEM as cloud service Hi Team, We need to store metadata — specifically the page path and timestamp — so that a scheduler can later pick it up and create a content package based on that path. Can we store this data under /var/project/storeData in AEM as a Cloud Service? We intend for this data to exist only on the author instance and not be replicated to publish. Thanks, Geo
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Hi @georhe6
In AEM as a Cloud Service, storing metadata like page path and timestamp for later processing by a scheduler is a valid use case. Yes, you can store this data under /var/project/storeData, but there are a few important considerations:
Recommendations:
- /var is appropriate: The /var node is designed for transient, non-replicated data that is only needed on the author instance. Your path /var/project/storeData is suitable for such storage, especially since you don’t want this metadata replicated to publish.
- Author-only data: By default, anything under /var is not replicated to publish, aligning with your goal.
You can store the data programmatically using a Sling POST or via a service user and ResourceResolver, like:
Map<String, Object> properties = new HashMap<>();
properties.put("pagePath", "/content/your-site/your-page");
properties.put("timestamp", System.currentTimeMillis());
ResourceResolver resolver = ...; // get with service user
Resource parent = resolver.getResource("/var/project/storeData");
if (parent != null) {
resolver.adaptTo(PageManager.class).create(
parent.getPath(),
"entry-" + UUID.randomUUID(), // unique node
null,
properties
);
}Or using JCR API:
Node storeData = session.getNode("/var/project/storeData");
Node entry = storeData.addNode("entry-" + UUID.randomUUID(), "nt:unstructured");
entry.setProperty("pagePath", "/content/your-site/your-page");
entry.setProperty("timestamp", Calendar.getInstance());
session.save();Make sure you:
- Use a system user with write permissions to /var/project/storeData.
- Register the mapping in your repoinit script if the folder needs to be created during deployment.
Hope this helpful.
Regards,
Karishma.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.