Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.
Nível 1
Nível 2
Faça login na Comunidade
Faça logon para exibir todas as medalhas
Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.
******************************************************************************************************************************************************************************
Hi,
We have implemented an Event Handler registered as below:
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingConstants;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.api.resource.observation.ResourceChangeListener;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is a node observer class which would observe the path /content/we-retail
* for any addition or updation of nodes (type = cq:PageContent).
* @author
*/
@Component(label = "Test Event Listener", immediate = true, metatype =
false, enabled = true)
@Properties({
/* @Property(name = EventConstants.EVENT_TOPIC, value = ReplicationAction.EVENT_TOPIC)
})*/
@Property(name = EventConstants.EVENT_TOPIC, value =
{"org/apache/sling/api/resource/Resource/ADDED",
"org/apache/sling/api/resource/Resource/CHANGED"}),
@Property(name = EventConstants.EVENT_FILTER, value = "(&" +
"(path=/content/we-retail/us/en/*/jcr:content) (|(" + SlingConstants
.PROPERTY_CHANGED_ATTRIBUTES + "=*jcr:title) "
+ "(" + ResourceChangeListener.CHANGES + "=*jcr:title)))")
})
@Service(EventHandler.class)
public class TestEventHandler implements EventHandler {
private static final Logger LOG = LoggerFactory.getLogger(TestEventHandler.class);
/*
* Reference of ResourceResolverFactory object.
*/
@Reference
private ResourceResolverFactory resourceResolverFactory;
/*
* (non-Javadoc)
* @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
*/
@Override
public void handleEvent(Event event) {
LOG.info("Hi event is called ......");
}
}
Issue is: Our handleEvent doesn't get trapped when change the property value for jcr:title on any page under the path: /content/we-retail/us/en
AEM version is: 6.4
sling version used is : org.apache.sling.api
Solucionado! Ir para a Solução.
Visualizações
respostas
Total de curtidas
This works on AEM 6.4. Please follow all steps in the article - including creating a system user and using the Sling Mapping Service - Creating an Event Listener for Adobe Experience Manager 6.4
Visualizações
respostas
Total de curtidas
Hi,
Can you try with JCR events.
aem63app-repo/SampleJCREvent.java at master · arunpatidar02/aem63app-repo · GitHub
OR
You are using Felix annotation, try with osgi annotations.
aem63app-repo/TestEventHandler.java at master · arunpatidar02/aem63app-repo · GitHub
Visualizações
respostas
Total de curtidas
Hey,
I tried all above mentioned things in the Vanilla instance and found below result:
First Link: Below link didn't get work in my case, Listener didn't get invoked.
aem63app-repo/SampleJCREvent.java at master arunpatidar02/aem63app-repo GitHub
Second below link worked in my case with one exception: It is not giving the the property got changed under mentioned resource as given below screen shot.
aem63app-repo/TestEventHandler.java at master arunpatidar02/aem63app-repo GitHub
Please let me know in case of any solution found. If I got something will post the same here for sure.
Thanks
Visualizações
respostas
Total de curtidas
Hi,
Try using sling Resource Change Listener.
Visualizações
respostas
Total de curtidas
Hey Santhi,
I have already tried please read my below blog.
Listeners and handlers are not giving changed or added property names issue in 6.4
Regards
Visualizações
respostas
Total de curtidas
This works on AEM 6.4. Please follow all steps in the article - including creating a system user and using the Sling Mapping Service - Creating an Event Listener for Adobe Experience Manager 6.4
Visualizações
respostas
Total de curtidas
Visualizações
Curtida
respostas
Visualizações
Curtida
respostas
Visualizações
Curtida
respostas