예제 #1
0
        public override async Task <WorkLog> DoWorkAsync(IList <WorkLog> workLogs, WorkItemBase workItem = null)
        {
            TokenFileWorkResult workResult = GetWorkLog <TokenFileWorkResult>(workLogs);

            Console.WriteLine($"Sending file: {workResult.UntokenizedFileName}");

            await Task.Delay(TimeSpan.FromSeconds(3));

            if (new Random().Next(1, 100) < 50)
            {
                throw new Exception("SendFileProcess");
            }

            Guid id = await Task.Run(() => Guid.NewGuid());

            Console.WriteLine("Sent file Id: {0}", id);

            SendFileWorkResult result = new SendFileWorkResult
            {
                LogConnectDirect = "Log Connect Direct",
                WorkId           = id,
                Success          = true
            };

            return(new WorkLog(this, result));
        }
예제 #2
0
        public override async Task <WorkLog> DoWorkAsync(IList <WorkLog> workLogs, WorkItemBase workItem = null)
        {
            SendFileWorkResult workResult = GetWorkLog <SendFileWorkResult>(workLogs);

            Console.WriteLine($"Mapping send log: {workResult.LogConnectDirect}");

            dynamic id = await RetryHelper.RetryAsync <Exception>(async() => await PostWorkItemEndpointAddress <Guid>(), 3, TimeSpan.FromSeconds(3), Logger);

            Console.WriteLine("Mapped send log Id: {0}", id);

            MapSendLogWorkResult result = new MapSendLogWorkResult
            {
                SendLogId = 200,
                WorkId    = id,
                Success   = true
            };

            return(new WorkLog(this, result));
        }