Sobes.tech
Middle

Task: Events are received from users, each needs to be verified in an external source, but it does not respond immediately. Implement VerificationService which: - Accepts events from users - Tries to verify each by contacting an external service - If the response is PENDING, retries sending this event no earlier than 5 seconds later - Maximum 3 attempts, after which the event ID is output to stdout with status FAILED - Successfully processed events are output to stdout with status VERIFIED The templates and stubs of external dependencies are already implemented: 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 }

Task: Events are received from users, each needs to… - sobes.tech