コード例 #1
0
        /// <summary>
        /// Schedules a recurring message to be sent to the bus using a Publish, which should only be used when
        /// the quartz service is on a single shared queue or behind a distributor
        /// </summary>
        /// <typeparam name="T">The scheduled message type</typeparam>
        /// <param name="publishEndpoint">The bus from which the scheduled message command should be published</param>
        /// <param name="destinationAddress">The destination address where the schedule message should be sent</param>
        /// <param name="schedule">The recurring schedule instance</param>
        /// <param name="message">The message to send</param>
        /// <param name="contextCallback">Optional: A callback that gives the caller access to the publish context.</param>
        /// <returns>A handled to the scheduled message</returns>
        public static async Task <ScheduledRecurringMessage <T> > ScheduleRecurringMessage <T>(this IPublishEndpoint publishEndpoint, Uri destinationAddress,
                                                                                               RecurringSchedule schedule, T message, IPipe <PublishContext <ScheduleRecurringMessage <T> > > contextCallback = null)
            where T : class
        {
            var command = new ScheduleRecurringMessageCommand <T>(schedule, destinationAddress, message);

            await publishEndpoint.Publish(command, contextCallback ?? Pipe.Empty <PublishContext <ScheduleRecurringMessage <T> > >()).ConfigureAwait(false);

            return(new ScheduledRecurringMessageHandle <T>(command.Schedule, command.Destination, command.Payload));
        }
コード例 #2
0
        public static async Task <ScheduledRecurringMessage <T> > ScheduleRecurringSend <T>(this ISendEndpoint endpoint, Uri destinationAddress,
                                                                                            RecurringSchedule schedule, T message)
            where T : class
        {
            var command = new ScheduleRecurringMessageCommand <T>(schedule, destinationAddress, message);

            await endpoint.Send <ScheduleRecurringMessage <T> >(command).ConfigureAwait(false);

            return(new ScheduledRecurringMessageHandle <T>(command.Schedule, command.Destination, command.Payload));
        }