Configuration changes for AEM Schedulers?

后端 未结 2 755
你的背包
你的背包 2021-01-29 05:56

I am trying to implement simple scheduler for my project requirement, my project is using Adobe AEM. As of now I gone through Adobe site and tried to implement the

2条回答
  •  星月不相逢
    2021-01-29 06:27

    You missed to set immediate = true. This starts/activates an component/service automatically with the bundle-start. Otherwise the service is only started, if another (already started) service requests this service (or has a dependency).

    In OSGi all services are lazy started, and stopped as soon as nobody needs them. I agree, it could be improved, if the scheduler service would automatically start all services that it would trigger. But that's the way it is.


    This is a working example.

    @Component(immediate = true, metatype = true)
    @Service({ Runnable.class, AnotherServiceInterface.class})
    @Properties({
       // run every 5 seconds
       @Property(name = "scheduler.period", longValue = 5),
       // no concurrent execution
       @Property(name = "scheduler.concurrent", propertyPrivate = true, boolValue = false)
    })
    

提交回复
热议问题