Quantcast
Channel: Adobe Community : Popular Discussions - CQ5 (read only)
Viewing all articles
Browse latest Browse all 12476

EventHandler for my own Events

$
0
0

How can I make an EventHandler listening to only my own Events?

I have the following EventHandler implementation:

=== Java class ===

@Component(immediate = true, metatype = false)

@Service

@Property(name = EventConstants.EVENT_TOPIC, value = MyProcessor.EVENT_TOPIC)

public class MyProcessor implements EventHandler {

    public static final String EVENT_TOPIC = "my/event/handling";

 

 

    /*

     * (non-Javadoc) org.apache.sling.event.EventUtil

     *

     * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)

     */

    @Override

    public void handleEvent(final Event inEvent) {

        // do event handling

    }

}

===

 

But what information do I have to provide in my component's cd:EditConfig to make the system sending the appropriate Event my event handler class is listening to?

===

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"

    cq:dialogMode="floating"

    jcr:primaryType="cq:EditConfig">

    <cq:listeners

        jcr:primaryType="cq:EditListenersConfig"

        beforeinsert="myAction"

        />

</jcr:root>

===

What value do I have to provide for the beforinsert action (in this example) to trigger the event handles by my handler?

 

Regards,

Benno


Viewing all articles
Browse latest Browse all 12476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>