Sobes.tech

Zadanie: Zdarzenia są odbierane od użytkowników, każde musi być zweryfikowane w zewnętrznym źródle, ale ono nie odpowiada natychmiast. Zaimplementuj VerificationService, który: - Przyjmuje zdarzenia od użytkowników - Próbuje zweryfikować każde, kontaktując się z zewnętrzną usługą - Jeśli odpowiedź to PENDING, ponawia wysyłanie tego zdarzenia nie wcześniej niż po 5 sekundach - Maksymalnie 3 próby, po których identyfikator zdarzenia jest wyświetlany w stdout z statusem FAILED - Pomyślnie przetworzone zdarzenia są wyświetlane w stdout z statusem VERIFIED Szablony i szkice zależności zewnętrznych są już zaimplementowane: 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 }

47

Čo umožnilo zvýšenie priepustnosti služby replikácie z približne 300 na 700 správ za sekundu? Ako boli použité ConcurrentDictionary a SemaphoreSlim?

45

Zoznam<Action> akcie = new List<Action>(); za každú z 10 iterácií { akcie.Add(() => System.Console.WriteLine(count)); } za každú akciu { akcia(); } Čo bude v stdout?

42

public class A { public virtual void Print1() { System.Console.Write("A"); } public void Print2() { System.Console.Write("A"); } } public class B : A { public override void Print1() { System.Console.Write("B"); } } public class C : B { public new void Print2() { System.Console.Write("C"); } } static void Main(string[] args) { var c = new C(); A a = c; a.Print1(); a.Print2(); c.Print2(); } Čo bude v stdout?

28

public struct S : IDisposable { private bool dispose; public void Dispose() { dispose = true; } public bool GetDispose() { return dispose; } } Čo bude v stdout?

24

[meno] nám povedz o zaujímavej úlohe alebo riešení na tvojom súčasnom alebo predchádzajúcom mieste práce, ktoré by si chcel zdieľať.

22