Reverse replication in custom file upload component not works
I'm trying to write custom file upload component for CQ5.6, but I meet the problem with reverse replication. Node created in Publish instance, but not replicated to Author instance. After replicator call, next line appears in error.log:
com.day.cq.replication.impl.ReplicatorImpl Replication triggered, but no agent found or selected.
Replication agents are turned on. In other cases, userforms for example, replication works successfully, so I'm think the problem is somewhere in my code. There is the code I use in the servlet:
Node node = session.getNode(path); ValueFactory valueFactory = session.getValueFactory(); Binary contentValue = valueFactory.createBinary(is); Node parent = node.addNode(fileName, "nt:unstructured"); parent.setProperty(DELETED, false); parent.setProperty(DESCRIPTION, description); Node fileNode = parent.addNode(fileName, "nt:file"); fileNode.addMixin("mix:referenceable"); Node resNode = fileNode.addNode("jcr:content", "nt:resource"); resNode.setProperty(Property.JCR_DATA, contentValue); Calendar lastModified = Calendar.getInstance(); lastModified.setTimeInMillis(lastModified.getTimeInMillis()); resNode.setProperty(Property.JCR_LAST_MODIFIED, lastModified); parent.setProperty("cq:distribute", true); parent.setProperty("cq:lastModified", Calendar.getInstance()); parent.setProperty("cq:lastModifiedBy", session.getUserID()); session.save(); replicator.replicate(session, ReplicationActionType.ACTIVATE, parent.getPath()); session.logout();What should I do to make reverse replication works for this nodes I create in servlet?
P.S. I've spent hours reading documentation, but not found any solution.