AEM6.4 - Execute Event Handler on Activation workflow | Community
Skip to main content
elizabethp60981
Level 3
August 12, 2019

AEM6.4 - Execute Event Handler on Activation workflow

  • August 12, 2019
  • 2 replies
  • 8479 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Himanshu_Singhal
Community Advisor
Community Advisor
August 13, 2019

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-samples · GitHub

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
August 13, 2019

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!

Gaurav-Behl
Level 10
August 13, 2019

Did you get a chance to check ACS AEM Samples

You may swap SCR annotations with OSGI annotations. Refer - Re: Difference between SCR as well as R6 Annotation​ for examples

elizabethp60981
Level 3
August 13, 2019

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

April 25, 2022

@elizabethp60981 , Did you get the replication event listener? If Yes, please share how you implemented the replication or activation event handler.

Thanks in advance.