Wednesday, February 15, 2017

Custom Transport Handler in CQ/AEM6

Custom Transport Handler in CQ5.6/AEM6


There are a lot of blogs written on this one. However, none of them explain about how it should be unit tested and what are the point a programmer should have in mind while using a custom transport handler. I am going to list down few of them below.

1. There must be a custom ContentBuilder defined. An example definition could be as follows.

@Component(metatype = false)
@Service(ContentBuilder.class)
@Property(name = "name", value = "Custom Content Builder")
public class CustomContentBuilder implements ContentBuilder {
public static final String NAME = "Custom Content Builder";
public static final String TITLE = "Custom Content Builder";
public ReplicationContent create(Session session, ReplicationAction action,
ReplicationContentFactory factory) throws ReplicationException {
return ReplicationContent.VOID;
}
public String getName() {
return TITLE;
}
public String getTitle() {
return TITLE;
}
public ReplicationContent create(Session session, ReplicationAction action,
ReplicationContentFactory factory, Map<String, Object> arg3){
// TODO Auto-generated method stub
return ReplicationContent.VOID;
}
}
2. While defining your agent in author agents that uses your custom transport handler, select your custom content builder's name i.e.  in above case it is "Custom Content Builder" as a value of Synchronization Type.


In above example instead of default it should be "Custom Content Builder"

Notes : The custom handler can be invoked on the author environment by invoking activate request on the page. This works fine even when the custom handler is configured on the publish side and the request is invoked from author side in case of AEM 6.0 but, this will not work fine in CQ5.6


3 comments:

  1. Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up.
    zurich airport taxi

    ReplyDelete
  2. Can you tell me ,

    How to make custom replication agent for activating page and its assets using custom content builder and custom transport handler.
    Provide code if possible.

    ReplyDelete
    Replies
    1. Why do you want code? So that you can copy paste from here?

      Delete

Some more AEM 6 Interview Questions for Architects

 Some more AEM 6 Interview Questions for Architects 1. Consider you have a workflow with two steps. One step is to transfer the asset from s...