[英]Expired job executions in Spring Batch
Problem 问题
Users can submit data to generate a report, which triggers a spring-batch job. 用户可以提交数据以生成报告,该报告将触发春季批量作业。 If the same data is submitted (by the same user or another user) the same report should be generated such that Spring Batch doesn't start a new job, under the premise that the report has already been generated. 如果(同一用户或另一用户)提交了相同的数据,则应在生成报告的前提下,生成相同的报告,以使Spring Batch不会启动新作业。
To make matters a little more complicated, generated reports expire after 90 days. 更复杂的是,生成的报告会在90天后过期。 The idea behind this is that the data gleaned from various web services used to build the report is likely out of date. 其背后的想法是,用于构建报告的各种Web服务收集的数据可能已过时。 Therefore, after 90 days the report should be re-generated using new data from those web services. 因此,在90天后,应使用这些Web服务中的新数据重新生成报告。
Questions 问题
When a job has already run, how can I discover the job execution id for that job? 作业已经运行后,如何找到该作业的作业执行ID? This id is used in the URL to uniquely identify a report. URL中使用此ID来唯一标识报告。 JobExplorer
is severely limited in querying Spring Batch data. JobExplorer
在查询Spring Batch数据方面受到严格限制。
How can I trigger another instance of the job only after 90 days? 仅在90天后如何触发该作业的另一个实例? The issue is that given duplicate job parameters, a JobInstanceAlreadyCompleteException
will be thrown. 问题是,给定重复的作业参数,将抛出JobInstanceAlreadyCompleteException
。 Must I encode the 90 days has an extra identifying parameter, or is there an easier way? 我必须对90天编码进行编码,是否需要额外的识别参数,还是有更简单的方法?
Clean up old jobs must be done using business methods as well as for expired reports. 清理旧作业必须使用业务方法以及过期的报告来完成。
After this premise you can try a different path to solve your problem: 在此前提下,您可以尝试其他方法来解决您的问题:
Of course, generated report metadata tables are different from SB tables and should be accessed using DAO related to domain context (the report in your case). 当然,生成的报告元数据表与SB表不同,应该使用与域上下文相关的DAO(在您的情况下为报告)进行访问。
Can this a valid alternative? 这可以替代吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.