Quartz.net Cron触发某些时区不起作用

发布于 2025-01-27 10:14:44 字数 964 浏览 3 评论 0原文

我正在使用MassTransit.Quarts库和.NET Core来安排一些将属于不同时区的作业。我要注意的是,预定的作业是针对某些时区而不是其他时区触发的。

以下是我使用MassTransit库来安排工作的方式:

 public async Task ScheduleRecurringMessage<T>(string destinationAddress, string scheduleId, string scheduledGroupId, string timeZoneId, DateTimeOffset startTime, DateTimeOffset? endTime, string cronExpression, T message) where T : class
    {
        var destinationUri = string.Format("rabbitmq://{0}/{1}.{2}", eventbusConfig.Value.EventBusUri, eventbusConfig.Value.EventBusEndpointName, destinationAddress);

        var recurringSchedule = new MasstransitRecurringSchedule(timeZoneId, startTime, endTime, scheduleId, scheduledGroupId, cronExpression);
        await sendEndpoint.ScheduleRecurringSend<T>(new Uri(destinationUri), recurringSchedule, message);
    }

但是,当我检查[QRTZ_CRON_TRIGGERS]表时,我可以看到所有计划的作业都可以在此处正确记录在此处,并针对正确的时区。但是,UTC-时区(例如EST),调度程序并未将事件触发到RabbitMQ。

谁能帮助我身份为什么会发生这种情况?

I'm using masstransit.quarts library with .NET Core to schedule some jobs that would fall under different timezones. What I'm observing is, the scheduled jobs get triggered for certain timezone and not for the others.

Following is how I use the masstransit library to schedule the job:

 public async Task ScheduleRecurringMessage<T>(string destinationAddress, string scheduleId, string scheduledGroupId, string timeZoneId, DateTimeOffset startTime, DateTimeOffset? endTime, string cronExpression, T message) where T : class
    {
        var destinationUri = string.Format("rabbitmq://{0}/{1}.{2}", eventbusConfig.Value.EventBusUri, eventbusConfig.Value.EventBusEndpointName, destinationAddress);

        var recurringSchedule = new MasstransitRecurringSchedule(timeZoneId, startTime, endTime, scheduleId, scheduledGroupId, cronExpression);
        await sendEndpoint.ScheduleRecurringSend<T>(new Uri(destinationUri), recurringSchedule, message);
    }

However, when I check the [QRTZ_CRON_TRIGGERS] table, I can see that all scheduled jobs get correctly recorded here, against the correct timezone. However, UTC- timezones (e.g. EST), the scheduler doesnt trigger the event to Rabbitmq.

Can anyone help me identity why this is happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文