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 {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.
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;
}
}
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