Expand my Community achievements bar.

SOLVED

Scheduling jobs in AEM Author Environment

Avatar

Level 5

Dear team,

We have scheduled a job on author environment it is working fine, but my concern is when the project is replicated on publish environment will the job be also scheduled on publish. If yes then please suggest how do we avoid this scenario.

Note:- Currently My project folder contains component rendering, servlets and scheduler classes

with regards,

Richa Chaubey

1 Accepted Solution

Avatar

Correct answer by
Level 10

In your scheduling service you can define

  • @Component(policy = ConfigurationPolicy.REQUIRE)

Now, create only the OSGI Config only for author runmode.

Your service will never be satisfied in publish instance so no execution.

You can refer: http://www.computepatterns.com/43/osgi-component-in-aem-that-is-active-only-in-specific-run-mode-say...

View solution in original post

3 Replies

Avatar

Level 8

Hi,

Generally have seen activate methods in scheduler which will have something like

this.isEnabled = PropertiesUtil.toBoolean(properties.get("scheduler.enable"), false);

So, may be by default its disabled and only if enabled it will work , irrespective of the environments.

May be we can await inputs from other members as well on this.

Avatar

Correct answer by
Level 10

In your scheduling service you can define

  • @Component(policy = ConfigurationPolicy.REQUIRE)

Now, create only the OSGI Config only for author runmode.

Your service will never be satisfied in publish instance so no execution.

You can refer: http://www.computepatterns.com/43/osgi-component-in-aem-that-is-active-only-in-specific-run-mode-say...