如何在CRON URI中添加自定义日历?

问题描述 投票:-1回答:1

calendar = new org.quartz.calendar();from(“ quartz2:// myGroup / myTimerName?cron = 0 + 0/5 + 12-18 +?+ * + MON-FRI&customCalendar” + calendar).to(“ activemq:Totally.Rocks”)

apache-camel quartz-scheduler
1个回答
0
投票
[当您需要在路由中使用实例时,必须在Camel Registry中声明它。因此,您应该希望它一直在这里[1]

使用@bindToRegistry批注,您可以将实例添加到注册表中,并且可以在路由中通过'#'符号来引用它。

from("quartz2://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI&customCalendar=#calendar").to("activemq:Totally.Rocks")

其中日历是您在@bindToRegistry批注中声明的名称。

请注意,此处链接的示例来自Camel 3。

也许也看看注册表文档[2]

[1] https://github.com/apache/camel/blob/master/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzCustomCalendarFireTest.java

[2] https://camel.apache.org/manual/latest/registry.html

© www.soinside.com 2019 - 2024. All rights reserved.