Sling Content Distribution - unable to publish the content
Hi Community,
I'm setting up Sling Content Distribution (SCD) in AEM as a Cloud Service to replicate content from Author to Publish using a custom agent and Java code.
Here’s the agent configuration (com.adobe.granite.distribution.core.impl.AgentConfiguration-myagent.config):
name="myagent"
enabled=B"true"
serviceName="sling/distribution/service/default"
serializationType="default"
log.level="info"
packageExporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/exporters/default"]
packageImporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/importers/default"]
transportSecretProvider.target="(name=default)"
And here's the code I'm using to trigger the distribution:
ResourceResolver resolver = resolverFactory.getServiceResourceResolver(
Collections.singletonMap(ResourceResolverFactory.SUBSERVICE, "distributionService"));
DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, "/content/myproject/en");
DistributionAgent agent = distributionAgent.get("myagent");
DistributionResponse response = agent.execute(request, resolver.adaptTo(Session.class));
The code runs without errors, but content is not getting pushed to Publish. Manual distribution via UI works fine.