英文:
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();
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论