Confirmed, the second event is always the one containing the jcr:data attribute.

BTW, the 1st google hit on garbage collection is your blog post Robert. So, 
thanks again.
http://robdecker.com/blog/basic_apache_sling_development_patterns

-Bruce

From: "Robert A. Decker" <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Monday, November 24, 2014 at 2:10 AM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: Duplicate TOPIC_RESOURCE_ADDED events for single WebDAV file 
creation

If I remember correctly, it’s because two nodes are added. A parent node and 
the sub jcr:data node.

It’s been awhile though so I could be wrong.

Another thing I remember working with webdav in sling was that when you edit 
the file outside over webdav, each save is saved in sling separately and the 
old saves aren’t cleaned up unless you do a repository garbage collection. You 
can fill up a hard drive pretty quickly if you’re automatically processing 
large numbers of files and you’re not cleaning up the repository.

Robert A. Decker

On 21 Nov 2014, at 20:25, Bruce Edge 
<[email protected]<mailto:[email protected]>> wrote:

Why do I get 2 TOPIC_RESOURCE_ADDED events for a single file being added
to a WebDAV folder?
Event 1:
event.topics = org/apache/sling/api/resource/Resource/ADDED
userid = admin
path = /incoming/new/testfile
resourceTypent:file
resourceAddedAttributes = [jcr:created, jcr:createdBy, jcr:primaryType]
Event 2:
event.topics = org/apache/sling/api/resource/Resource/ADDED
userid = admin
path = /incoming/new/testfile
resourceTypent:file
resourceAddedAttributes = [jcr:lastModified, jcr:mimeType, jcr:data,
jcr:primaryType, jcr:uuid, jcr:lastModifiedBy]
The difference being the resourceAddedAttributes list.
I know I can filter one out, but I¹d like to understand the rationale
behind sending these as separate events.
Is the second event due to sling adding additional metadata after
examining the content?
If so, where is this done, and is it in the same event change that I
process using handleEvent()?
-Bruce


Reply via email to