You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Cris Rockwell <cm...@umich.edu> on 2020/07/10 19:22:40 UTC

Sling Content Distribution (Forward) Event Monitoring for Testing and Client Notice

Hi all

In a forward SCD scenario, the process of resource distribution from source A to target instance B comprises a series of Sling Events [1] as configured in the forward agent settings[2]. In my scenario, the user should be informed about the success or failure of the distribution process as a whole. I also want some Sling JUnit testing of the forward distribution that do not rely on thread sleep. 

For example, a service starts forward distribution like this…

DistributionResponse distResponse = distributor.distribute(
    agentName,
    resourceResolver,
    new SimpleDistributionRequest(
        activate ?
            DistributionRequestType.ADD :
            DistributionRequestType.DELETE,
        paths)
);

If I pause and debug after that call, DistributionResponse object has properties: state=ACCEPTED, message=[QUEUED] and SimpleDistributionResponse.state=DISTRIBUTED. My programmatic tests to instance B fail, because I assume the processes of packaging, transporting and importing are still underway.

How does one identify and monitor the event instances associated with SCD?  In particular, on the source instance how can I monitor “distributed' and ‘dropped’ events. When it comes to notifying the client, how would these events be used in responding to a client given that these processes are asynchronous?

Any clues would be highly appreciated!

Cris 

[1]: https://sling.apache.org/documentation/bundles/content-distribution.html#events <https://sling.apache.org/documentation/bundles/content-distribution.html#events>
[2]: https://sling.apache.org/documentation/bundles/distribution.html#sling-job-handling-based-queue <https://sling.apache.org/documentation/bundles/distribution.html#sling-job-handling-based-queue>