情节:在计划工作中执行计划工作
是否可以在计划作业中执行计划作业。例如,我有一个计划作业A可以执行某些操作。还有另一个计划作业B在执行时间表A后执行后执行。因此,与其使用admin模式手动运行和运行作业,这是一个直接的选项,而是有没有办法成功执行作业A后可以执行作业B? 我找到了一个Ischeduledjobexecutor的接口,看起来确实如此,但我不确定是否可以这样做。 对此有什么想法吗?
Is it possible to execute a schedule job within a schedule job .For Instance ,I have a schedule job A that does some operations .There is another schedule job B that executes after Schedule Job A is executed. So rather than manually going and running the job using admin mode which is a straightforward option, Is there a way wherein I can execute job B after Job A is executed successfully?
I found an interface IScheduledJobExecutor which looks like it does but i am not sure if this is advisible to do that.
Any thoughts on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不会在类似的计划作业之间创建依赖关系。相反,请考虑重构代码,以便可以在同一计划的作业中执行 的业务逻辑。
因此,假设您将代码重构为
foo()
和bar()
。然后创建以下内容以获得最大灵活性:
计划作业a
执行foo()
仅bar()
bar()< /code>仅
计划的作业c
执行foo()
and bar()显然,您可能不会需要#1和#2,除非有充分的理由单独执行操作。
I would not create dependencies between scheduled jobs like that. Instead, consider refactoring your code so that the business logic of both operations can be carried out in the same scheduled job.
So, let's say you refactor your code into
Foo()
andBar()
.Then create the following for maximum flexibility:
Scheduled Job A
which executesFoo()
onlyScheduled Job B
which executesBar()
onlyScheduled Job C
which executes bothFoo()
andBar()
Obviously, you might not need #1 and #2 unless there is good reason for executing the operations individually.