Custom Replication Agent problem

Avatar

Avatar

Airtash

Avatar

Airtash

Airtash

05-03-2019

Hi everyone! Im new with adobe aem, actually Im working with 6.4 and Im trying to create a custom replication agent.

My problem is that when I build the code into aem and select the "Serialization Type" into the agent it fail and I receiving
"Agent is not valid. ContentBuilder not available"

01.JPG

I have following the next steps:

>I have tried creating a new agent, add the serialization type (custom) and fail.

>Copying from an existing agent, and also fails.

Im implementing ContentBuilder and TransportHandler, I just have only some logs into the implemented methods,I already have looked into Nate Yolles example

http://www.nateyolles.com/blog/2016/01/aem-akamai-custom-replication-agent

Im not copying the code because I want to understand how it works, also I have noticed there are some deprecated features in the annotations used in this example,

I have fix that, but Im not sure at all if the new annotations are causing the problem, also I have checked some documentation but so far it was not very helpful.

Im only using the @component annotation as you can see in the following code Im currently using:

Any sort of help highly appreciated.

Thanks in advance!.

------------------------------- TRANSPORT HANDLER ------------------------------------------------

@Component(name = "Custom Agent",immediate = true, enabled = true)

public class MyTransportHandler implements TransportHandler {

public boolean canHandle(AgentConfig config) {

log.info("+++++FROM CANHANDLE!!++++++");

return true;

}

public ReplicationResult deliver(TransportContext ctx, ReplicationTransaction tx) throws ReplicationException {

        ReplicationActionType replicationType = tx.getAction().getType();

        log.info("+++++FROM DELIVER!!++++++");

return ReplicationResult.OK;

}

---------------------------------------------CONTENTBUILDER-----------------------------------------------

@Component (service = ContentBuilder.class, enabled = true, name = "name")

public class TestContentBuilder implements ContentBuilder{

public ReplicationContent create(Session arg0, ReplicationAction arg1, ReplicationContentFactory arg2)

            throws ReplicationException {

        // TODO Auto-generated method stub

        return create(arg0,arg1,null);

    }

    @Override

    public ReplicationContent create(Session session, ReplicationAction action, ReplicationContentFactory factory,

            Map<String, Object> parameters) throws ReplicationException {

  log.info("---- FROM CONTENT BUILDER -----");

return ReplicationContent.VOID;

    }

@Override

    public String getName() {

        // TODO Auto-generated method stub

        return "Test AK";

    }

    @Override

    public String getTitle() {

        // TODO Auto-generated method stub

        return "Test AK Description";

    }   

--------------------------------------------------------------------------------------------------------------------

View Entire Topic

Avatar

Avatar

pradeepdubey82

Avatar

pradeepdubey82

pradeepdubey82

30-03-2019

Thank you Airtash. It worked.