Hi,
I might be bit silly to ask but please let me know if there is any Replication API which can fetch a property of a node during replication.
example:
I am getting path of the content which is getting replicated by replicationAction.getPath().
Is there any way i can fetch few properties from this path as well during replication. i need properties from Author Instance.
I need it for Akamai AEM SYNC.
Regards,
Anand
Views
Replies
Total Likes
Hi,
Above methods returns the path which is string. From string you can get the Node and from Node you can get properties.
from workflow session you can get it like below -
Node node = (Node) session.getSession().getItem(path);
Node (Content Repository for Java Technology API Version 2.0)
Views
Replies
Total Likes
Nice response!
Views
Replies
Total Likes
But isnt it going to give properties from publish instance?
i need properties from author instance which are getting replicated on publish instance.
regards,
manish
Views
Replies
Total Likes
That's not possible. You cannot cross these boundaries that easily (for a good reason).
If you want authoring properties to be available on publish as well, you have to replicate them. In your case why don't you attach these properties on author to the node which is going to be replicated?
Jörg
Views
Replies
Total Likes
Hi Jorg,
i have created an akamai agent which reads replication. I am trying to read a property at author and process my request at akamai.
if i attach a property to a node in author instance , and if i want to read it on publish instance than i need to replicate it first.
so basically for akamai,my author needs to replicate twice to read that property on publish.
i know durboimporter reads the properties from author during replication but is there any way to fetch properties during replication itself and make it available in my code?
i am fetching conteny path from replicationAction api. I could find any way to fetch properties also.
Regards,
Manish
Views
Replies
Total Likes
You may try creating a servlet on publisher which will be called from author with credentials and pass path as parameter and as a response returns page properties from publishers.
Author publisher everything except cq:lastReplicationAction, cq:lastreplicated and cq:lastReplicatedBy
but in 1:M or M:M environments you may ended up of making multiple requests.
Views
Replies
Total Likes
Ok, you lost me. Can you add a diagram (or just a list) describing at which system you should add which data and where you intend to read it?
Jörg
Views
Replies
Total Likes
i want to add a property in author and i want to fetch that same property during replication in publish.
i cant replicate to have that property in piblish and than again replicate to read that property.
i want that property during first replication.
Views
Replies
Total Likes
Making to many calls will be a problem.
Views
Replies
Total Likes
Ok, let me try to rephrase it:
1) On author, you add a property "prop" to node "/home/mysite/en/jcr:content"
2) On author, this page is replicated (either through code, or triggered by an user)
3) On any publish, this replication request is received, and the property "prop" is now available on /home/mysite/en/jcr:content
4) On any publish: Your custom action
Is this the order of steps correct? Or did I miss one? Because right now I cannot match my list to your approach, so I am obviously missing something.
Jörg
Views
Replies
Total Likes
Exactly..
but in third step during the replication i need the property to be available in my code.
it isnt published yet but it is in the process.. at that time the need to fetch this property.
is it possible?
Views
Replies
Total Likes
Just wondering, why not use replication preprocessor?
Do you see any issue?
Views
Replies
Total Likes
Hi Manish,
ok, understood. So let's rephrase it into:
1) On author, you add a property "prop" to node "/home/mysite/en/jcr:content"
2) On author, this page is replicated (either through code, or triggered by an user)
3) On any publish, during replication, custom code needs to read the property "prop" on /home/mysite/en/jcr:content
So, how are you hooking into this process, that you can say "during the replication"? What API do you use (or want to use) to achieve this? And if you post your complete usecase, we might come up with a better and simpler solution.
Jörg
Views
Replies
Total Likes
Hi edubey,
even if i preprocess it, will i be able to get property in publish instance from author?
i havent used it before. Correct me if i am wrong, doesnt it just check everything before replication?
but not actually replication.
Views
Replies
Total Likes
Hi Jorg,
i have created an agent which reads replication and then triggers akamai cache invalidate.
i am adding a check rule for author to decide if they need this content to be invalidated at akamai.
hence i am adding a property at page level and thinking to read that property during replication on publish and validate the akamai cache request.
Regards,
Manish
Views
Replies
Total Likes
Hi Manish,
what do you mean with "which reads replication and then triggers akamai cache invalidation"? Have you created your own dedicated endpoint (similar to /bin/receive, but different), which reads the changed page from the headers? Then I understand the problems you are facing.
What about creating a new replication agent on publish, which has the trigger "on receive" set? This is only triggered when an incoming replication has already been processed. When you invalidate through a HTTP call, you can either build a custom transport handler (if you want to create the connection on your own) or just a custom content builder (if you need to build a custom payload format), but you don't need to implement the complete logic on your own.
Jörg
Views
Replies
Total Likes
I have done exactly what you have written in second paragraph.
i have created my own contentBuilder and transportHandler.
i have created an agent on publish to process this akamai invalidate on RECEIVE.
but this invalidation process will be triggered as soon as it receives the replication, dont you think it will be too late for my code in publish to read this check property from author?
i tried this way but i was not able to read this check property during first replication.
Views
Replies
Total Likes
OK, now I understand.
OnReceive agents are triggered by Sling Events ("com/adobe/granite/replication"), and for every replication a new session is being opened. Technically it should see all changes of sessions which happened before the creation of this session. And I think that the Sling Event is being sent after the replication data has been persisted, the session available to your custom transporthandler and content builder should be able to see the data written by the incoming replication.
Do your contentbuilder and transport handler use a new session for their work? Potentially long-running?
Jörg
Views
Replies
Total Likes
Hi Jorg,
Yes, I am using a new session in order to create a ReplicationContent only in ContentBuilder.
Just passing the created content to transport handler and making a call to akamai.
Regards,
Manish
Views
Replies
Total Likes
That's really strange, because then the session save of the replication receiver thread and the creation of your session must overlap.
Maybe you can add debug statemnets to your code, and also enable DEBUG logging on repo writes (see [1] how to do it); then you can compare timestamps of the save and the time of the creation of your session.
[1] What is writing to my Oak repository? | Things on a content management system
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies