How to know if current instance is primary publisher | Community
Skip to main content
Shubham_borole
Community Advisor
Community Advisor
September 20, 2018
Solved

How to know if current instance is primary publisher

  • September 20, 2018
  • 4 replies
  • 1181 views

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

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

4 replies

Shubham_borole
Community Advisor
Community Advisor
September 20, 2018

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

smacdonald2008
Level 10
September 20, 2018

Nice response Arun!

Shubham_borole
Community Advisor
Community Advisor
September 25, 2018

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