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

Programmatically delete a package after replication.

Avatar

Avatar
Validate 1
Level 1
subramanya_vema
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
subramanya_vema
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_vema
Level 1

28-03-2018

In our current implementation of programatic package creation and replication to boost performance we have two flows:

1. Programmatically create a package of name admin_package.zip which uses com.day.cq.wcm.api.PageManager.create(path, packagename) when ever activation of home page is detected.

2. Replicate package created  in step1 using com.day.cq.replication.Replicator.replicate(session, ReplicationActionType.ACTIVATE, package.getNode().getPath());

The issue with this implementation is that whenever more than one author is activating the content (concurrent activation issue even though different pages) code is creating package of same name which is "admin_package.zip" for  both the authors as both of them issued activation requests at the same time. This is throwing javax.jcr.ItemExistsException for second concurrent request and replication fails for that request.

So what we are assuming that we will add time stamp to the package name and then delete programatically the package after replication.

I am not getting the code how to do efficient deletion of package after replication in code. Has anyone done this type of implementation.

Or anyone has similar problem but followed a different approach.

Please let me know ideas and implementation details.

View Entire Topic

Avatar

Avatar
Affirm 1
Level 1
radhabbharathi
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

2 solutions
Top badges earned
Affirm 1
View profile

Avatar
Affirm 1
Level 1
radhabbharathi
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

2 solutions
Top badges earned
Affirm 1
View profile
radhabbharathi
Level 1

29-03-2018

you can use PageMgr api : pagemanager.delete(resource,boolean)  , where resource will be your custom package.