Hi All,
Need AEM scheduler code in a bundle to pick osgi configuration and start execute automatically as soon as bundle is deployed.
Currently after deploying the bundle with scheduler code in it, every time have to save OSGI configuration for respective scheduler to get it start.
Any pointers across it would be really appreciated.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi,
Can you check if you used both Activate and Modified annotations for activate mathod
Sample Code -
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/SimpleScheduledTask.java
@activate
@Modified
protected void activate(final Config config) {
myParameter = config.myParameter();
}
Views
Replies
Total Likes
Already have set immediate = true but still no use
Views
Replies
Total Likes
Hi,
Can you check if you used both Activate and Modified annotations for activate mathod
Sample Code -
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/SimpleScheduledTask.java
@activate
@Modified
protected void activate(final Config config) {
myParameter = config.myParameter();
}
Views
Replies
Total Likes
Views
Replies
Total Likes
Can you check following -
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
This is the config class code.
package com.aem.core.services;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.AttributeType;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
@ObjectClassDefinition(name = "Scheduler Configuration", description = "Configuration for mentioned in Scheduler ")
public @interface SchedulerConfigItr {
@AttributeDefinition(name = "Scheduler name", description = "Name of the scheduler", type = AttributeType.STRING)
public String schedulerName() default "Extract Asset Metadata Scheduler";
@AttributeDefinition(name = "Enabled", description = "True, if scheduler service is enabled", type = AttributeType.BOOLEAN)
boolean serviceEnabled() default true;
@AttributeDefinition(name = "Cron Expression", description = "Cron expression based on which scheduler runs", type = AttributeType.STRING)
public String cronExpression() default "0 0/1 * 1/1 * ? *";
@AttributeDefinition(name = "Folder Path", description = "Define folder path for extraction of assets metadata", type = AttributeType.STRING)
public String folderPath() default "/content/dam/abc";
}
Do let me know if anything is missing ?
Views
Replies
Total Likes