AEM6.4 - Execute Event Handler on Activation workflow

Avatar

Avatar
Validate 10
Level 3
elizabethp60981
Level 3

Likes

8 likes

Total Posts

42 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
elizabethp60981
Level 3

Likes

8 likes

Total Posts

42 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
elizabethp60981
Level 3

12-08-2019

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.

Replies

Avatar

Avatar
Validate 25
MVP
Himanshu_Singhal
MVP

Likes

65 likes

Total Posts

206 posts

Correct reply

23 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 25
MVP
Himanshu_Singhal
MVP

Likes

65 likes

Total Posts

206 posts

Correct reply

23 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile
Himanshu_Singhal
MVP

12-08-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-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.

Avatar

Avatar
Validate 10
Level 3
elizabethp60981
Level 3

Likes

8 likes

Total Posts

42 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
elizabethp60981
Level 3

Likes

8 likes

Total Posts

42 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
elizabethp60981
Level 3

13-08-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!

Avatar

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

250 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

250 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile
Gaurav-Behl
MVP

13-08-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

Avatar

Avatar
Validate 10
Level 3
elizabethp60981
Level 3

Likes

8 likes

Total Posts

42 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
elizabethp60981
Level 3

Likes

8 likes

Total Posts

42 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
elizabethp60981
Level 3

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