情节:在计划工作中执行计划工作

发布于 2025-01-26 12:03:01 字数 189 浏览 3 评论 0原文

是否可以在计划作业中执行计划作业。例如,我有一个计划作业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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坏尐絯℡ 2025-02-02 12:03:01

我不会在类似的计划作业之间创建依赖关系。相反,请考虑重构代码,以便可以在同一计划的作业中执行 的业务逻辑。

因此,假设您将代码重构为foo()bar()

然后创建以下内容以获得最大灵活性:

  1. 计划作业a执行foo()
  2. 计划的作业b 执行bar()bar()< /code>仅
  3. 计划的作业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() and Bar().

Then create the following for maximum flexibility:

  1. Scheduled Job A which executes Foo() only
  2. Scheduled Job B which executes Bar() only
  3. Scheduled Job C which executes both Foo() and Bar()

Obviously, you might not need #1 and #2 unless there is good reason for executing the operations individually.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文