მოვალეობა: მომხმარებლებისგან მიღებული მოვლენები უნდა იყოს გადამოწმებული გარედან წყაროში, მაგრამ ის არ პასუხობს დაუყოვნებლივ.
შეასრულეთ VerificationService, რომელიც:
- იღებს მოვლენებს მომხმარებლებისგან
- ცდილობს თითოეული გადაამოწმოს დაკავშირებით გარედან სერვისთან
- თუ პასუხი არის PENDING, ცდილობს ამ მოვლენის გადაგზავნას არა უყურადღებოდ 5 წამზე ადრე
- მაქსიმუმ 3 მცდელობა, ამის შემდეგ მოვლენის ID გამოდის stdout-ზე FAILED სტატუსით
- წარმატებით დამუშავებული მოვლენები გამოდის stdout-ზე VERIFIED სტატუსით
გარე დამოკიდებულებების შაბლონები და სტაბები უკვე განხორციელებულია:
1. VerificationStatus
2. Event
3. VerificationResult
4. IExternalSource
public enum VerificationStatus { OK, Pending, Error }
public record Event(string Id, string Payload);
public record VerificationResult(VerificationStatus Status, string? Message = null);
public interface IExternalSource
{
VerificationResult Verify(string eventId);
}
public class VerificationService
{
private readonly IExternalSource _externalSource;
private const int MaxAttempts = 3;
private static readonly TimeSpan RetryDelay = TimeSpan.FromSeconds(5);
public VerificationService(IExternalSource externalSource)
{
_externalSource = externalSource;
}
// TODO: implement
}