[ https://issues.apache.org/jira/browse/SLING-9016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17026582#comment-17026582 ]
Timothee Maret commented on SLING-9016: --------------------------------------- Thanks [~ashishc], I merged your PR [#1|https://github.com/apache/sling-org-apache-sling-distribution-api/pull/1]. > Distribution Event should be generated when the package is dropped > ------------------------------------------------------------------ > > Key: SLING-9016 > URL: https://issues.apache.org/jira/browse/SLING-9016 > Project: Sling > Issue Type: Improvement > Components: Content Distribution > Reporter: Ashish Chopra > Assignee: Timothee Maret > Priority: Major > Fix For: Content Distribution Core 0.4.2, Content Distribution > API 0.4.0 > > Time Spent: 20m > Remaining Estimate: 0h > > We already have an event corresponding to the successful distribution of a > package [0]. > In the Distribution Core impl, this event is (correctly) generated when the > package is successfully distributed [1]. However, if the distribution agent > has a valid error-strategy associated with it and if the attempts to > distribute them exceed a fixed number of retries, the packages are moved > _silently_ to error-queue [2]. > I propose that this asymmetry be addressed. > Since {{DistributionEventTopics}} is a {{ProviderType}}, it should be > possible to introduce another constant (which queue-processors in > Distribution Core, as well as any custom ones) can use to identify failed > distribution-requests [3]. > Distribution Core can be further enhanced to create this event when it > re-enqueues the queue-item that has exceeded its retries in the error-queue > [4]. > [0] > https://github.com/apache/sling-org-apache-sling-distribution-api/blob/ff4c3ae5b7129ba7b1f4f59d35edf93bf6e3d63f/src/main/java/org/apache/sling/distribution/event/DistributionEventTopics.java#L44 > [1] > https://github.com/apache/sling-org-apache-sling-distribution-core/blob/537bb57af821f21537cf4a24ad7d2347c6a5dae1/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java#L137-L138 > [2] > https://github.com/apache/sling-org-apache-sling-distribution-core/blob/537bb57af821f21537cf4a24ad7d2347c6a5dae1/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java#L158-L160 > [3] > {noformat} > diff --git > a/src/main/java/org/apache/sling/distribution/event/DistributionEventTopics.java > > b/src/main/java/org/apache/sling/distribution/event/DistributionEventTopics.java > index 8a75dda..2be0358 100644 > --- > a/src/main/java/org/apache/sling/distribution/event/DistributionEventTopics.java > +++ > b/src/main/java/org/apache/sling/distribution/event/DistributionEventTopics.java > @@ -43,6 +43,10 @@ public interface DistributionEventTopics { > */ > String AGENT_PACKAGE_DISTRIBUTED = EVENT_BASE + > "/agent/package/distributed"; > + /** > + * event for package errored-out > + */ > + String AGENT_PACKAGE_ERRORED = EVENT_BASE + "/agent/package/errored"; > /** > * event for package imported > {noformat} > [4] > {noformat} > diff --git > a/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java > > b/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java > index 1a04fa7..eba47e9 100644 > --- > a/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java > +++ > b/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java > @@ -157,6 +157,8 @@ class SimpleDistributionAgentQueueProcessor implements > DistributionQueueProcesso > if (errorQueueStrategy != null && > queueItemStatus.getAttempts() > retryAttempts) { > removeItemFromQueue = > reEnqueuePackage(distributionPackage); > + > distributionEventFactory.generatePackageEvent(DistributionEventTopics.AGENT_PACKAGE_ERRORED, > + DistributionComponentKind.AGENT, agentName, > distributionPackage.getInfo()); > distributionLog.info("[{}] PACKAGE-QUEUED {}: > distribution package {} was enqueued to an error queue", queueName, > requestId, distributionPackage.getId()); > } > } > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)