async Task Simple(IEndpointInstance endpointInstance) { #region ScheduleTask // To send a message every 5 minutes await endpointInstance.ScheduleEvery( timeSpan : TimeSpan.FromMinutes(5), task : pipelineContext => { var message = new CallLegacySystem(); return(pipelineContext.Send(message)); }) .ConfigureAwait(false); // Name a schedule task and invoke it every 5 minutes await endpointInstance.ScheduleEvery( timeSpan : TimeSpan.FromMinutes(5), name : "MyCustomTask", task : pipelineContext => { log.Info("Custom Task executed"); return(Task.CompletedTask); }) .ConfigureAwait(false); #endregion }
void ScheduleTask(IBus bus) { #region ScheduleTask // 'Schedule' is a static class that can be accessed anywhere. // To send a message every 5 minutes Schedule.Every(TimeSpan.FromMinutes(5)) .Action( task: () => { var message = new CallLegacySystem(); bus.Send(message); }); // Name a schedule task and invoke it every 5 minutes Schedule.Every(TimeSpan.FromMinutes(5)) .Action( name: "MyCustomTask", task: () => { log.Info("Custom Task executed"); }); #endregion }
Scheduling(Schedule schedule, IBus bus) { #region ScheduleTask // 'Schedule' is an instance class that can be resolved from dependency injection // To send a message every 5 minutes schedule.Every( timeSpan: TimeSpan.FromMinutes(5), task: () => { var message = new CallLegacySystem(); bus.Send(message); }); // Name a schedule task and invoke it every 5 minutes schedule.Every( timeSpan: TimeSpan.FromMinutes(5), name: "MyCustomTask", task: () => { log.Info("Custom Task executed"); }); #endregion }
public void Timeout(ExecuteTask state) { // Action that gets executed when the specified time is up var callLegacySystem = new CallLegacySystem(); Bus.Send(callLegacySystem); // Reschedule the task RequestUtcTimeout <ExecuteTask>(TimeSpan.FromMinutes(5)); }
Scheduling(Schedule schedule, IBus bus) { #region ScheduleTask // 'Schedule' is an instance class that can be resolved from the container. // To send a message every 5 minutes schedule.Every(TimeSpan.FromMinutes(5), () => { var callLegacySystem = new CallLegacySystem(); bus.Send(callLegacySystem); }); // Name a schedule task and invoke it every 5 minutes schedule.Every(TimeSpan.FromMinutes(5), "MyCustomTask", SomeCustomMethod); #endregion }
void ScheduleTask(IBus bus) { #region ScheduleTask // 'Schedule' is a static class that can be accessed anywhere. // To send a message every 5 minutes Schedule.Every(TimeSpan.FromMinutes(5)) .Action(() => { var callLegacySystem = new CallLegacySystem(); bus.Send(callLegacySystem); }); // Name a schedule task and invoke it every 5 minutes Schedule.Every(TimeSpan.FromMinutes(5)) .Action("MyCustomTask", SomeCustomMethod); #endregion }
Scheduling(IBus bus) { #region ScheduleTask // 'Schedule' is a static class that can be accessed anywhere. // To send a message every 5 minutes Schedule.Every(TimeSpan.FromMinutes(5)) .Action(() => { var callLegacySystem = new CallLegacySystem(); bus.Send(callLegacySystem); }); // Name a schedule task and invoke it every 5 minutes Schedule.Every(TimeSpan.FromMinutes(5)) .Action("MyCustomTask", SomeCustomMethod); #endregion }
Scheduling(IEndpointInstance endpointInstance) { #region ScheduleTask // To send a message every 5 minutes endpointInstance.ScheduleEvery( timeSpan: TimeSpan.FromMinutes(5), task: context => { var message = new CallLegacySystem(); return(context.Send(message)); }); // Name a schedule task and invoke it every 5 minutes endpointInstance.ScheduleEvery( timeSpan: TimeSpan.FromMinutes(5), name: "MyCustomTask", task: SomeCustomMethod); #endregion }