石英和夸克斯

huangapple go评论138阅读模式
英文:

Quartz and Quarkus

问题

我正在尝试在 Quarkus 中使用 Quartz。

在指南中:https://quarkus.io/guides/quartz

他们创建了一个应用程序范围的 TaskBean,它创建一个作业实例,当执行时只执行一些操作来持久化一个空的 Task 实体。

依我之见,这看起来不是很干净,也没有多大帮助,据我理解。我更倾向于遵循 Quartz 的更默认的设置 - 因此我已经创建了一个“经典”的 Job 来执行工作 - 并将其添加到了调度程序中。一切都运行得很好。现在,我只需要将一个服务注入到这个作业中,类似于:
http://vijaykiran.com/2013/01/a-quick-way-to-integrate-seam3-cdi-and-quartz-jobs/

这里是否有人之前可能已经为 Quarkus 做过类似的事情?

英文:

I am trying to use Quartz with Quarkus.
In the guide: https://quarkus.io/guides/quartz

They create an application scoped TaskBean, that creates a job instance, that when executed
does nothing but persisting an empty Task entity.

This IMHO doesn't look very clean and doesn't help much either a far as I understand it.
I am rather trying to follow a more default setup of Quartz - so I have create a "classical" Job that is supposed to do the work - and I added this to the scheduler. All working fine. Now I just need to inject a service into this job, something similar to:
http://vijaykiran.com/2013/01/a-quick-way-to-integrate-seam3-cdi-and-quartz-jobs/

Has anyone here possibly done this for Quarkus before?

答案1

得分: 1

此时,Quarkus不支持将依赖项注入到Quartz作业中 - 根据我的请求,补丁正在进行中。同时,您可以通过以下方式直接从Arc中检索实例:Arc.container().instance(YourClass.class).get();

英文:

At this point, Quarkus does not support injection into Quartz Jobs - based on my request a patch is on the way. In the meantime, you can directly retrieve an instance from Arc like this: Arc.container().instance(YourClass.class).get();

huangapple
  • 本文由 发表于 2020年8月20日 03:41:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/63493896.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定