[DOCU-2620] Basic PageListener example config is confusing Created: 07/Dec/22  Updated: 21/Dec/22  Resolved: 21/Dec/22

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Raphael Falvo Assignee: Alex Mansell
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File config.yaml     PNG File image-2022-12-07-13-30-35-471.png     PNG File screenshot-1.png    
Documentation page URL: https://docs.magnolia-cms.com/product-docs/6.2/Modules/List-of-modules/Observation-module.html#_listener_configuration
Reporter Name: Raphael Falvo
Email: raphael.falvo@magnolia-cms.com

 Description   

Basic PageListener example config is confusing. User tends to believe that using nodeType property in a simple Listener would help to filter nodes based on passed nodeType, but it actually doesn't work.

Looking at the definition app using this config shows that the property is not mapped in PageListener example.

 

This property is mapped only in advanced listeners provided by the module like RestrictToNodeTypeEventListener or SpecifiedNodeTypeOnlyEventListener, but not in basic Listener class that would just implement EventListener interface. 

It seems that the description of the property tries to explain it a bit but it is still not 100% clear that this property doesn't work on any listener class.

 



 Comments   
Comment by Jaroslav Simak [ 08/Dec/22 ]

The nodeType is in the wrong place. It should be one level above, under the listener node.

See also: https://git.magnolia-cms.com/projects/MODULES/repos/observation/browse/src/main/java/info/magnolia/module/observation/ObservationConfiguration.java

Comment by Raphael Falvo [ 08/Dec/22 ]

Hey amansell, jsimak 

Just found an interesting link while having issues when trying to use the nodeType config at the right place:
https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/12_Observation.html
 
Chapter 12.5.3.4.3 Node Type :
Only events whose associated parent node is of one of the node types in the nodeTypeNames String array will be received. If this parameter is null then no node type-related restriction is placed on events received. Note that specifying an empty array instead of null results in no nodes being listened to.
When using nodeType filtering parameter in the config, I was hoping to get the nodes having the matching nodeType, but you actually get the nodes for which parent node has the matching nodeType  
I think this information deserves to be in the documentation to avoid headaches for the module users.
 
jsimak Could you confirm my saying?

Comment by Jaroslav Simak [ 08/Dec/22 ]

Can you send me an export of your configuration? I will check the behavior.

Comment by Raphael Falvo [ 08/Dec/22 ]

You can find config.yaml file in attachement jsimak 
I wanted to remove includeSubNodes property, but without the event is not triggered at all.

To test it I upload an asset using Upload Zip archive option

 

You can find the context here :
https://git.magnolia-cms.com/projects/INCUBATOR/repos/dam-focal/commits/cad15a5c1193917453d5d9fe4ebf8fbafea795ec#magnolia-dam-focal-area/src/main/resources/dam-focal-area/decorations/observation/config.yaml

Comment by Jaroslav Simak [ 08/Dec/22 ]

Cool, thanks. I will check out your branch and see what's happening there.

Comment by Jaroslav Simak [ 09/Dec/22 ]

I can confirm the behavior you described. I received events only when I created nodes under mgnl:page node type which I defined in the config.

Comment by Raphael Falvo [ 09/Dec/22 ]

Thank you jsimak

Generated at Mon Feb 12 01:28:44 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.