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.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @AryaBa1,
Could you confirm your Transport Secret Provider.
Make sure you have this config on Author:
# com.adobe.granite.distribution.core.impl.AgentConfiguration-myagent.config
name="myagent"
enabled=B"true"
serviceName="myagent"
serializationType="default"
packageExporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/importers/default"]
transportSecretProvider.target="(serviceName=myagent)"
And on Publish, create this OSGi config:
# com.adobe.granite.distribution.transport.impl.SecretTransportAuthenticationProviderFactory-myagent.config
serviceName="myagent"
username="distribution-user"
password="your-password"
Also worth to check:
distribution-user exists on Publish with permissions
The importer endpoint (default) is active
myagent matches in code and config
Hi @AryaBa1,
Could you confirm your Transport Secret Provider.
Make sure you have this config on Author:
# com.adobe.granite.distribution.core.impl.AgentConfiguration-myagent.config
name="myagent"
enabled=B"true"
serviceName="myagent"
serializationType="default"
packageExporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/importers/default"]
transportSecretProvider.target="(serviceName=myagent)"
And on Publish, create this OSGi config:
# com.adobe.granite.distribution.transport.impl.SecretTransportAuthenticationProviderFactory-myagent.config
serviceName="myagent"
username="distribution-user"
password="your-password"
Also worth to check:
distribution-user exists on Publish with permissions
The importer endpoint (default) is active
myagent matches in code and config
Thanks @SantoshSai it worked after adding the correct serviceName and credentials on the Publish side.
Views
Replies
Total Likes
Why do you use Content Distribution to replicate content from author to publish? Isn't it possible for you to use the Replication API for that?
Views
Replies
Total Likes
Views
Likes
Replies