Esempio n. 1
0
        public override async Task <WorkLog> DoWorkAsync(IList <WorkLog> workLogs, WorkItemBase workItem = null)
        {
            MapFileWorkResult    workResultMap        = GetWorkLog <MapFileWorkResult>(workLogs);
            MapSendLogWorkResult workResultMapSendLog = GetWorkLog <MapSendLogWorkResult>(workLogs);

            Console.WriteLine($"Validate Map File - ClearingFileId: {workResultMap.ClearingFileId}");
            Console.WriteLine($"Validate Map Send Log - SendLogId: {workResultMapSendLog.SendLogId}");

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

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

            Guid id = Guid.NewGuid();

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

            ValidateFileWorkResult result = new ValidateFileWorkResult
            {
                WorkId  = id,
                Success = true
            };

            return(new WorkLog(this, result));
        }
Esempio n. 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));
        }