如何在 Sling 中创建 JobConsumer?

问题描述

根据 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 的正确方法。 有谁知道如何编写与上述等效的代码?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)