【发布时间】:2021-06-07 21:59:20
【问题描述】:
根据Apache Sling官网(https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html#job-consumers),这是JobConsumer的写法。
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.event.jobs.Job;
import org.apache.sling.event.jobs.consumer.JobConsumer;
@Component
@Service(value={JobConsumer.class})
@Property(name=JobConsumer.PROPERTY_TOPICS, value="my/special/jobtopic",)
public class MyJobConsumer implements JobConsumer {
public JobResult process(final Job job) {
// process the job and return the result
return JobResult.OK;
}
}
但是@Service 和@Property 都是不推荐使用的注解。 我想知道创建 JobConsumer 的正确方法。 有谁知道如何编写与上述等效的代码?
【问题讨论】:
标签: java aem apache-felix sling