Expand my Community achievements bar.

SOLVED

How to know if current instance is primary publisher

Avatar

Community Advisor

Hi All,

If writing a logic to run certain tasks only if user is on primary publisher, in Java looking to identify if user is on a primary publish instance.

I see that AEM Communities Publisher Configuration has "isPrimaryPublisher" from which this can be obtained. Any suggestion of achieving this in best way?

The pid of the config seem to point to an impl class so not sure if @Reference would work.

Using AEM 6.2 SP1 FP3 cfp14

Thanks

Shubham

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
4 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Community Advisor

Yup took a look at that, was wondering more if some one has already tried this.

Will update in case I get a chance to try and get the value for isPrimaryPublisher.

Thanks

Avatar

Community Advisor

Thanks Arun,

Just to add a bit more, I was able to achieve this using below in a tag class.

PublisherConfiguration pc = sling.getService(PublisherConfiguration.class);

Similarly for a servlet or a service impl class it seems we can use @Reference for the class PublisherConfiguration

Thanks again,

Shubham