DotNetWorkQueue.ASendJobToQueue.SendAsync C# (CSharp) Method

SendAsync() public method

Sends the specified action to the specified queue.
public SendAsync ( IScheduledJob job, DateTimeOffset scheduledTime, Expression actionToRun ) : Task
job IScheduledJob The job.
scheduledTime DateTimeOffset The scheduled time.
actionToRun Expression The action to run.
return Task
        public async Task<IJobQueueOutputMessage> SendAsync(IScheduledJob job, DateTimeOffset scheduledTime, Expression<Action<IReceivedMessage<MessageExpression>, IWorkerNotification>> actionToRun)
        {
            var data = SendPreChecks(job.Name, scheduledTime);
            if (data != null)
                return data;

            var messageData = new AdditionalMessageData();
            SetMetaDataForJob(job.Name, scheduledTime,
                new DateTimeOffset(GetTimeFactory.Create().GetCurrentUtcDate()), job.Route, messageData);

            var message = await Queue.SendAsync(actionToRun, messageData).ConfigureAwait(false);
            var result = ProcessResult(job, scheduledTime, message);
            if (result != null) return result;
            //try one more time
            result = ProcessResult(job, scheduledTime, await Queue.SendAsync(actionToRun, messageData).ConfigureAwait(false));
            return result ?? new JobQueueOutputMessage(JobQueuedStatus.Failed);
        }

Same methods

ASendJobToQueue::SendAsync ( IScheduledJob job, DateTimeOffset scheduledTime, LinqExpressionToRun expressionToRun ) : Task