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]> 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