Expand my Community achievements bar.

SOLVED

Can we extend AssetDuplicationDetector to send email instead of notification in case of duplicate images

Avatar

Level 4

  We have OOTB  feature to GET notification incase of duplicate Asset uploaded ,If we enable the  Asset duplicate detector configuration . Can we extend this com.adobe.cq.assetcompute.impl.assetprocessor.AssetDuplicationDetector class to send email instead of notification in AEM as cloud.  Please suggest solution for the same.

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

hi @sanketd27011989,

I would try one of the following approaches: 

  • Event-driven via Adobe I/O Events for AEM Assets: Subscribe to assets events such as “asset ready” to receive payloads that include repository metadata like dam:sha1, then query AEM for assets with the same hash; if duplicates are found, send email via a service of choice. Reference: here

  • AEM-side listener after processing: Implement a listener that reacts once the asset state is processed (for example, checking jcr:content/dam:assetState), look up duplicates by dam:sha1, and send an email using the Day CQ Mail Service configuration.

To check for duplicates, you can use the SHA-1 fingerprint stored at jcr:content/metadata/dam:sha1. By querying other assets that share this SHA-1 value, you can identify potential duplicates regardless of their filename or path. In other words, you can run a query on the dam:Asset nodes where dam:sha1 matches the hash of the current asset. Any additional results returned by the query can be considered duplicates.

View solution in original post

2 Replies

Avatar

Community Advisor

Hi @sanketd27011989,

I think, you can’t directly extend or override com.adobe.cq.assetcompute.impl.assetprocessor.AssetDuplicationDetector in AEM as a Cloud Service, because:

  • It’s an internal OSGi implementation class managed by Adobe inside the Asset Compute pipeline.

  • In AEMaaCS, you don’t have control over modifying or subclassing these OOTB services.

That said, you can build a supported extension pattern:

  • You can register an OSGi EventHandler or Sling Job Consumer that listens for:

    • com.day.cq.dam.api.DamEvent.ASSET_DUPLICATE (event type fired on duplicate).

  • In your handler, trigger an Email Service (com.day.cq.mailer.DefaultMailService) to send an email.
    OR

  • Configure a custom workflow step after the duplication check in your asset ingestion workflow model.

  •  

  • In that step, use the Email Service to notify recipients with asset details.


Santosh Sai

AEM BlogsLinkedIn


Avatar

Correct answer by
Level 10

hi @sanketd27011989,

I would try one of the following approaches: 

  • Event-driven via Adobe I/O Events for AEM Assets: Subscribe to assets events such as “asset ready” to receive payloads that include repository metadata like dam:sha1, then query AEM for assets with the same hash; if duplicates are found, send email via a service of choice. Reference: here

  • AEM-side listener after processing: Implement a listener that reacts once the asset state is processed (for example, checking jcr:content/dam:assetState), look up duplicates by dam:sha1, and send an email using the Day CQ Mail Service configuration.

To check for duplicates, you can use the SHA-1 fingerprint stored at jcr:content/metadata/dam:sha1. By querying other assets that share this SHA-1 value, you can identify potential duplicates regardless of their filename or path. In other words, you can run a query on the dam:Asset nodes where dam:sha1 matches the hash of the current asset. Any additional results returned by the query can be considered duplicates.