Expand my Community achievements bar.

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

Issues setting up Distribution Agent

Avatar

Level 2

My use-case is :
1. Setup a custom distribution agent
2. On modify, add, delete etc JCR events the agent will get triggered. [This I will be able to achieve via JCREventDistributionTriggerFactory once the Distribution Agent config is setup correctly].
3. I do not have a publish instance so my requirement is the agent will parse the path and then post the data to a servlet which in turn should be fetched somehow and the data that was posted needs to be printed in the error.log as of now.

I tried setting up the distribution agent but I am not sure how to do it accurately when I don't have publisher. 

The Settings tab keeps showing error. Can someone help me with the configuration setup for the distribution agent? (org.apache.sling.distribution.agent.impl.ForwardDistributionAgentFactory-my-agent.cfg.json is what I tried using - it does create the agent but it does not work).

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hi @ArindamCh,

You can give this a try - it should work even without a publish instance.

Since you just want the agent to send data to a servlet instead of a publish instance, you can use a Forward Distribution Agent and point it directly to your servlet URL.

Here’s a sample config you can start with (org.apache.sling.distribution.agent.impl.ForwardDistributionAgentFactory-my-agent.cfg.json

{
  "name": "my-agent",
  "enabled": true,
  "queue.processing.enabled": true,
  "allowed.roots": ["/content"],
  "packageImporter.endpoints": ["http://localhost:4502/bin/my-distribution-servlet"],
  "requestAuthorizationStrategy.target": "(name=default)",
  "transportSecretProvider.target": "(name=default)"
}

Then, add a trigger using JcrEventDistributionTriggerFactory so the agent fires on add/modify/delete events:

{
  "path": "/content",
  "deep": true
}

Once this is set up, try making a content change - the agent should send a POST request to your servlet.
You can log whatever you receive there into error.log just to confirm the data flow.

If you still see an error under the “Settings” tab, it usually means one of the references (like packageBuilder or requestAuthorizationStrategy) isn’t resolving properly - you can check that under /system/console/components and make sure the dependencies are active.

 


Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 2

Hi @SantoshSai - thank you. I was able to set the distribution agent correctly.

Now facing issues while trying to deliver package. Also Test Connection returns the same error.
An error has occurred while attempting to deliver test package. [org.apache.sling.distribution.common.RecoverableDistributionException: not enough rights for http://localhost:4502/bin/distribution/json-exporter]

I tried this from admin account which has all the access but still facing this. Also when things are automated via JCR Event Distribution Trigger Factory - logs say that replication-service is posting the data. Now same error message I am receiving.

2025/10/13 00:56:39:201 - INFO - enabling trigger org.apache.sling.distribution.trigger.impl.JcrEventDistributionTriggerFactory@416275af
2025/10/13 00:58:24:373 - INFO - REQUEST-START DSTRQ1: ADD paths=[/content/dam/fmdita-outputs/json/standalone-map/standalone-map_ditamap.json/jcr:content/metadata], user=replication-service
2025/10/13 00:58:24:432 - WARN - [endpoint0] PACKAGE-FAIL DSTRQ1: could not deliver dstrpck-1760297304399-d2868235-2bfb-4dc5-b0d5-731daca9a340, not enough rights for http://localhost:4502/bin/distribution/json-exporter

For replication-service the access to /bin is there but limited - No modify access. This I am also not able to change since it remains grayed out.

Please help me out with what needs to be done.

Thanks,
Arindam