Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Fetching Node Property during replication

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

23-07-2018

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

Accepted Solutions (0)

Answers (20)

Answers (20)

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

28-07-2018

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

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

26-07-2018

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

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

25-07-2018

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

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

25-07-2018

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.

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

25-07-2018

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

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

25-07-2018

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

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

25-07-2018

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.

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

24-07-2018

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

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

276 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

276 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

24-07-2018

Just wondering, why not use replication preprocessor?
Do you see any issue?

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

24-07-2018

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?

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

24-07-2018

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

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

24-07-2018

Making to many calls will be a problem.

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

24-07-2018

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.

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

24-07-2018

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

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

24-07-2018

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.

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

23-07-2018

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

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

23-07-2018

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

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

23-07-2018

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

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

23-07-2018

Nice response!

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

23-07-2018

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)