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

How to append custom calendar in CRON URI?

日历=新org.quartz.calendar(); 从("quartz2://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI&customCalendar"+日历).到("activemq:Totally.Rocks")

当你需要在你的路由中使用一个实例时,你必须在 Camel Registry 中声明它。所以你应该喜欢它一直在这里 [1]

使用@bindToRegistry 注释,您可以将您的实例添加到注册表中,您将能够在您的路由中通过“#”符号引用它。

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

其中 calendar 是您在 @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