Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AEM6.4 - Execute Event Handler on Activation workflow

elizabethp60981
Level 3
Level 3

Hi,

I am facing the problem below.

I have a workflow to publish a content on a specific node when it is updated.

On the other hand, I have an action on my bundle that has to be executed when this content is activated.

I am following this tutorial below. but my class is not been called when workflow is completed. I realized that this class is using some deprecated method.

Adobe CQ Help | Creating Replication Event Handlers for Adobe Experience Manager

Has someone implemented this on AEM6.4? If so, is there a most current tutorial?

My class does not have errors, but does is not working as well.

I appreciate any help.

Thanks in advance.

4 Replies
Himanshu_Singhal
Community Advisor
Community Advisor

Do not use the EventHandler anymore. You can use the Resource Change Listener to listen to node event and implement any custom operations.

acs-aem-samples/SampleResourceChangeListener.java at master · Adobe-Consulting-Services/acs-aem-samp...

You can follow this example however it contains Felix annotations. Attaching sample code with OSGI annotations:

@Component(

        service = ResourceChangeListener.class,

        property = {

                ResourceChangeListener.PATHS + "=" + "/<add path here>",

                ResourceChangeListener.CHANGES + "=" + "ADDED"

        }

)

public class Sample implements ResourceChangeListener {

    @Override

    public void onChange(@Nonnull List<ResourceChange> list) {

        try {

            for (final ResourceChange change : list) {

               

            }

        } catch (Exception e) {

            LOGGER.error("Exception {}", e);

        }

    }

}

Hope, it helps.

elizabethp60981
Level 3
Level 3

Hi,

thank you very much for your answer!

So, I noticed that the events that I am able to use are "ADDED", "CHANGED", "REMOVED", but there is not replication events.

If I use changed event for example, the class will be called when the change is on author mode and when the change is on publish mode as well?

Thank you once more!

elizabethp60981
Level 3
Level 3

Thank you, but it was told to me to not use Event Handler anymore.

I am already using OSGI annotations but ResourceChangeListener does not have an event type to identify the replication of a node,

how can I identify a replication of a node and then call some method???