Expand my Community achievements bar.

AEM 6.2: Multiple classes implementing Preprocessor. Which one is picked first?

Avatar

Community Advisor

I created two classes (eg MyClass1 & MyClass2) implementing the com.day.cq.replication.Preprocessor interface.

In both I override the preprocess() and add logs.

When I activate a page, always MyClass1 (for eg) log statements are printed first. What is the reason for this and how can I control which of the Preprocessor class should be picked first?

My class looks like below:

@Service(Preprocessor.class)

@Component(metatype = true,

label="Class One",

description="Do something")

public class MyClass1 implements Preprocessor {

    private static final Logger LOG = LoggerFactory.getLogger(MyClass1.class);

   

   

    @Reference

    private Replicator replicator;

  

    /**

     *

     *

     * @see Preprocessor#preprocess(ReplicationAction, ReplicationOptions)

     */

    @Override

    public void preprocess(ReplicationAction action, ReplicationOptions options) throws ReplicationException {

LOG.info("In MyClass1")

    }

    }

2 Replies

Avatar

Community Advisor

Thanks for the response. I tried adding below but still that class is  not hit first..

@Service(Preprocessor.class)

@Component(metatype = true,

label="Class One",

description="Do something")

@Properties({

    @Property(name=Constants.SERVICE_RANKING, intValue=8000000, propertyPrivate=true)

})

Is there an example that can be tried?

Updated above. Also tried with and without 'propertyPrivate=true'