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.