Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

Sling Content Distribution - unable to publish the content

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

Reference:
https://www.albinsblog.com/2020/08/sling-content-distribution-in-aem-sync-content-between-publish-in...


Santosh Sai

AEM BlogsLinkedIn


View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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

Reference:
https://www.albinsblog.com/2020/08/sling-content-distribution-in-aem-sync-content-between-publish-in...


Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 2

Thanks @SantoshSai it worked after adding the correct serviceName and credentials on the Publish side.

Avatar

Employee Advisor

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?