AEM Scheduler 的配置发生变化吗?

2024-01-10

我正在尝试为我的项目需求实现简单的调度程序,我的项目正在使用Adobe AEM。截至目前,我浏览了 Adob​​e 网站并尝试实现所提供的给定示例,但没有一个更新我的error.log file.

package sling.docu.examples;
import com.majesco.logger.service.impl.Logger;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.apache.felix.scr.annotations.Property;
import com.majesco.dcf.common.util.CommonConstants;
@Component
@Service(value = Runnable.class)
@Property( name = "scheduler.period", longValue = 10)
public class ScheduledPeriodicJob implements Runnable {
    Logger logger = new Logger().getInstance(CommonConstants.COMMONSERVICE_MODULE_ID);
    public void run() {
        logger.debug("#########################################");
        logger.debug("*****************************************");
        logger.debug("*****************************************");
        logger.debug("*****************************************");
        logger.debug("******** ScheduledPeriodicJob ***********");
        logger.debug("*****************************************");
        logger.debug("*****************************************");
        logger.debug("*****************************************");
        logger.debug("#########################################");
    }
}

所以,根据this https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html#scheduling-at-periodic-times,它应该可以工作

pom.xml对于依赖项

<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.majesco</groupId>
        <artifactId>customerportal</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <groupId>com.majesco</groupId>
    <artifactId>commonservice</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>commonservice</name>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> 
            <version>3.8.1</version> <scope>test</scope> </dependency> -->

        <dependency>
            <groupId>com.majesco</groupId>
            <artifactId>objectmodel</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>


        <dependency>
            <groupId>com.majesco</groupId>
            <artifactId>logger</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- Simple Json -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
        </dependency>


        <!-- Hibernate Core API -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.5.Final</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate.common/hibernate-commons-annotations -->
        <!-- <dependency>
            <groupId>org.hibernate.common</groupId>
            <artifactId>hibernate-commons-annotations</artifactId>
            <version>4.0.1.Final</version>
        </dependency> -->



        <!-- postgresql Driver -->
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>

    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20160212</version>
    </dependency>


        <!-- EHCache Core APIs -->
        <!-- <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> 
            <version>2.6.9</version> </dependency> -->
        <!-- Hibernate EHCache API -->
        <!-- <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> 
            <version>4.3.5.Final</version> </dependency> -->

        <!-- EHCache uses slf4j for logging -->
        <!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> 
            <version>1.7.5</version> </dependency> -->

        <!-- @log4j2 xml dependency -->
        <!-- <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> 
            <version>2.0</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> 
            <artifactId>log4j-core</artifactId> <version>2.0</version> </dependency> -->

        <!-- javax.mail dependency -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- slf4j-api dependency -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>
        <!-- slf4j-simple dependency -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.5</version>
        </dependency>

        <!-- pgichecksum dependency -->
        <dependency>
            <groupId>com.billdesk.pgidsk</groupId>
            <artifactId>pgichecksum</artifactId>
            <version>1.0</version>
        </dependency>

        <!-- esbservicesclient dependency -->
        <dependency>
            <groupId>esbservices_client</groupId>
            <artifactId>esbservicesclient</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- esbpolicysearchclient dependency -->
        <dependency>
            <groupId>esbpolicysearch_client</groupId>
            <artifactId>esbpolicysearchclient</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- esbcustomerserviceclient dependency -->
        <dependency>
            <groupId>esbcustomerservice_client</groupId>
            <artifactId>esbcustomerserviceclient</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- esbcustomerserviceclient dependency -->
        <dependency>
            <groupId>esbaccountservice_client</groupId>
            <artifactId>esbaccountserviceclient</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- esbgenericserviceclient dependency -->
        <dependency>
            <groupId>esbgenericservice_client</groupId>
            <artifactId>esbgenericserviceclient</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- esbgenericintegrationclient dependency -->
        <dependency>
            <groupId>genericintegration_client</groupId>
            <artifactId>esbgenericintegrationclient</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- Start pooja added 040817-->
         <dependency>
            <groupId>esbusermanagement_client</groupId>
            <artifactId>esbusermanagementclient</artifactId>
            <version>0.0.1-SNAPSHOT </version>
        </dependency>
        <!-- End pooja added 040817-->

        <!-- Start pooja added 050917-->
         <dependency>
            <groupId>esbrenewalstatus_client</groupId>
            <artifactId>esbrenewalstatusclient</artifactId>
            <version>0.0.1-SNAPSHOT </version>
        </dependency>
        <!-- End pooja added 050917-->


        <!-- updateCustomerService<07062018> dependency -->
        <dependency>
            <groupId>esbupdatecustomer_service</groupId>
            <artifactId>esbupdatecustomerservice</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- updateCustomerService<07062018> dependency -->

        <!-- esbdatabasefetchservice dependency -->
        <dependency>
            <groupId>esbdatabasefetchservice_client</groupId>
            <artifactId>esbdatabasefetchservice</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- esbdatabasefetchservice dependency -->



        <!-- base64 commons-codec -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.0</version>
        </dependency>


        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>6.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>5.0.0</version>
        </dependency>

        <!-- Added for send email functionality -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>

<!-- 1574973 start -->
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr.annotations</artifactId>
            <version>1.6.0</version>
        </dependency>

        <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>osgi.annotation</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
         </dependency>

         <dependency>
                <groupId>org.osgi</groupId>                
                <artifactId>org.osgi.service.component.annotations</artifactId>
                <version>1.3.0</version>
                <scope>provided</scope>
          </dependency>

          <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.service.metatype.annotations</artifactId>
                <version>1.3.0</version>
                <scope>provided</scope>
          </dependency>

          <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.1</version>
        </dependency>



<!-- 1574973 end -->

    </dependencies>

    <build>

        <resources>
            <!-- standard Maven folder -->
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <!-- plus root folder -->
            <resource>
                <directory>.</directory>
                <includes>
                    <include>plugin.xml</include>
                    <include>META-INF/*</include>
                </includes>
            </resource>
        </resources>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>

                <configuration>
                    <unpackBundle>true</unpackBundle>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <!-- <Export-Package>com.majesco.portal.service.*;version=${project.version}</Export-Package> -->
                        <!-- <Import-Package>*</Import-Package> -->
                        <!-- <Import-Package>!*</Import-Package> <Embed-Dependency>*</Embed-Dependency> 
                            <Bundle-ClassPath>.</Bundle-ClassPath> -->
                        <!-- <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy> -->
                        <!-- <Embed-Dependency>*</Embed-Dependency> -->
                        <Embed-Dependency>!objectmodel,*</Embed-Dependency>
                        <Export-Package>com.majesco.dcf.common.*,com.majesco.dcf.pg.*,com.majesco.dcf.receipt.*,com.unotechsoft.stub.*,stub.unotechsoft.com.wsdl*,org.apache.http.impl.client*,org.apache.http.ssl*,org.apache.http*,org.apache*,org.datacontract.schemas*</Export-Package>
                        <Import-Package>org.osgi.framework,org.hibernate.*,com.majesco.dcf.pa.json,org.json.*,*;resolution:=optional</Import-Package>
                        <!-- <Export-Package>${export.packages}</Export-Package> -->
                        <!-- <Export-Package>!com.majesco.service.activator,com.majesco.service.*;version=${project.version}</Export-Package> -->
                        <Bundle-Activator>com.majesco.dcf.common.service.activator.CommonServiceBundleActivator</Bundle-Activator>
                    </instructions>
                </configuration>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <show>private</show>
                    <nohelp>true</nohelp>
                    <excludePackageNames>com.majesco.dcf.common.util*,com.majesco.dcf.common.service.activator*,com.majesco.dcf.common.entity*,com.majesco.dcf.common.service.impl*,com.majesco.dcf.pg.entity*,com.majesco.dcf.pg.service*,com.majesco.dcf.pg.util*,com.majesco.dcf.pg.billdesk.impl*,com.majesco.dcf.receipt.util*</excludePackageNames>
                </configuration>
            </plugin>

        </plugins>

    </build>

</project>

我需要进行任何其他更改才能使调度程序正常工作吗?请提出缺少的内容。


你错过了设置immediate = true。这会通过捆绑启动自动启动/激活组件/服务。否则,仅当另一个(已启动的)服务请求此服务(或具有依赖性)时,该服务才会启动。

在 OSGi 中,所有服务都是惰性启动的,并在没有人需要时立即停止。我同意,如果调度程序服务能够自动启动它会触发的所有服务,那么它可以得到改进。但事实就是这样。


这是一个工作示例。

@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)
})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

AEM Scheduler 的配置发生变化吗? 的相关文章

随机推荐

  • 如何使用原生库

    例如 我有一个 C 库 名为HelperLib 我有一些假设 我可以将这个项目编译成 so 文件 通过一些在线教程帮助我在 Android 上构建这个库 我可以在 C C 中使用这个库 通过图书馆网站上的官方教程 我对本机库有基本的了解 例
  • Struts 1 - 我的 Web 应用程序未找到 struts-taglib.jar

    我在用Struts 1 我开发了一个基于struts 的Web 应用程序 我在 JSP 页面中使用 struts 标签struts taglib jar通过在 JSP 文件中插入以下行 现在 当我在本地系统上运行该应用程序时 该应用程序工作
  • 发送到 Socket IO socket.id

    我正在尝试发送到特定的套接字 ID socket user playID emit correct data 但我得到 TypeError object is not a function 如果我退出user playID 我确实得到了一个
  • JavaScript 更改输入值时的事件?

  • .NET DLL 需要接收 Clarion 回调过程,然后将其全部传递给三个整数?

    我正在为 Clarion Clarion 是类似 C 的编程语言 程序编写 C NET DLL 我调用 C NET DLL 一切正常 一切正常 但是 我需要 C NET DLL 接收用于回调目的的 Clarion 过程 然后能够传递三个 i
  • 属性的命名约定[关闭]

    Closed 这个问题是基于意见的 help closed questions 目前不接受答案 哪一个更好或更清楚 public int FrozenRegionWidth get set Or public int WidthOfFroz
  • 将多个 Pandas DataFrame 列设置为单列中的值或同时设置多个标量值

    我正在尝试将多个新列设置为一列 并分别将多个新列设置为多个标量值 也做不到 除了单独设置之外还有什么办法吗 df pd DataFrame columns A B data np arange 6 reshape 3 2 df loc C
  • 如何使用express-uploadfile从POST读取文本文件?

    我正在尝试制作 Node js 服务器 用于在那里上传文本文件 所以我使用 POST 来获取本地用户的文本文件 然后我想让服务器读取该文件 我想我可以让用户上传他的本地文本文件 我可以获取上传文件的描述 但很难让服务器读取文件的实际字符串
  • Chrome 的自动填充隐藏文本输入的背景图像

    成功禁用自动填充黄色背景颜色后 我偶然发现了另一个功能 我的每个输入元素都有一个背景图像 每次我关注文本输入时 浏览器都会在下拉列表中建议我之前使用的值 选择一个值后 自动填充会覆盖整个背景并隐藏图像 这是我的 html 和 css 在 J
  • NHibernate:System.Argument异常:已添加具有相同键的项目

    我遇到了一个很难重现的偶发错误 我的第一个猜测是 不知怎的 我有一个泄漏的休眠会话 但是当我运行休眠分析器 http nhprof com 我没有看到太多异常 MVC 2 0 流畅版本1 1 0 685 NHibernate 版本 2 1
  • 使用三元运算符初始化结构

    为什么三元运算符不能用于初始化结构类型 而可以用于初始化基类型 例如int 示例代码 include
  • javascript向所有函数添加原型方法?

    有没有一种方法可以在不使用原型库的情况下向所有 javascript 函数添加方法 类似于 Function prototype methodName function return dowhateverto this 这是我到目前为止所尝
  • Perl 6 中有快速并行“for”循环吗?

    给定一些对 1 到 500000 之间的每个数字进行一些数学 转换的代码 我们有选择 简单的for循环 for 500000 gt i my result i 2 Str 在我的不科学基准测试中 这需要 2 8 秒 最规范的并行版本在一个P
  • 新的 SQL Server 用户登录失败

    我已在 SQL Server Management Studio SQL Server 2008 Express 的安全选项卡中创建了新用户 指定登录名 SQL Server 身份验证 输入密码 分配服务器角色sysadmin 映射到我的数
  • 如何检查元素是否在 iframe 内

    假设您有一个 DOM 节点 并且您想知道它是否位于 iframe 内 一种方法是检查它的父链 看看您是否在到达父窗口之前到达了 iframe 不过 我想知道是否有更快的方法来做到这一点 你也许可以检查ownerDocument财产 http
  • 强制使用 SSL:尝试确定托管应用程序的 DNC 进程的进程 ID 时发生错误

    我想在我的网站上强制使用 https 如果发现本文 https azure microsoft com en us documentation articles web sites configure ssl certificate 4 e
  • 使用 Perl 发送电子邮件

    我正在尝试使用 Perl 发送电子邮件 基本上我有一个 Perl 脚本 可以以良好的格式打印出报告 我希望通过电子邮件发送该报告 我怎样才能做到这一点 如果机器没有配置sendmail 我通常使用邮件 发送邮件 https metacpan
  • 如何根据位置分割字符串

    我想根据字符的位置拆分变量 生成的第一个字符串应具有指定位置之前的前一个位置 另一个字符串应包含其他部分 假设如果我有一个变量 var 2013AD 我想 var1 2013 and var2 AD 我怎样才能实现这个目标 嗯 要在这里使用
  • 如何使用 Selenium WebDriver 检查单选按钮?

    我想检查这个单选按钮 但我不知道如何检查 我的 HTML 是 div class appendContent div id contentContainer class grid list template gt div div div d
  • AEM Scheduler 的配置发生变化吗?

    我正在尝试为我的项目需求实现简单的调度程序 我的项目正在使用Adobe AEM 截至目前 我浏览了 Adob e 网站并尝试实现所提供的给定示例 但没有一个更新我的error log file package sling docu exam