protected override void Context() { Global.TypesToScan = typeof(Test).Assembly.GetTypes(); _eventConverterFactory = new EventConverterFactory(); _event = _eventFactory.Create<SomethingHappenedEvent>(e => {}); }
protected override void Context() { Global.TypesToScan = typeof(Test).Assembly.GetTypes(); _eventConverterFactory = new EventConverterFactory(); _event = _eventFactory.Create <SomethingHappenedEvent>(e => {}); }
public void Handle(SomethingHappenedEvent message) { Data.DataId = message.DataId; //Request a timeout RequestTimeout <Saga2Timeout>(TimeSpan.FromSeconds(5)); }
protected override void Context() { _eventConversionRunner = new EventConversionRunner(_eventConverterFactory.Object); _somethingHappenedEvent = _eventFactory.Create <SomethingHappenedEvent>(e => {}); _somethingElseHappenedEvent = _eventFactory.Create <SomethingElseHappenedEvent>(e => {}); _eventConverterFactory.Setup(f => f.Get(typeof(SomethingHappenedEvent))).Returns(e => { _convertedEvents.Add((IEvent)e); return(_somethingElseHappenedEvent); }); }
public TestStreamTestPostsModule() { Post["/teststream/somethinghappened"] = parameters => { var postContent = this.Bind <SomethingHappenedPostData>(); SomethingHappenedEvent evt = new SomethingHappenedEvent() { Description = postContent.Description }; TestStreamRepository.AddEvent(evt); return(HttpStatusCode.Created); }; }
public void Handle(SomethingHappenedEvent msg) { Logger.Trace($"Widgetizing - Something happened: {msg.Description}"); var randomDouble = _random.NextDouble(); bool succeeds = randomDouble > FailureProbability; if (!succeeds) { var failureMessage = $"Randomized failure caused handler to throw exception. Probability value = {randomDouble}"; Logger.Error($"Random handler failure : {failureMessage}"); throw new DummyHandlerException(failureMessage); } Logger.Debug($"Random handler SUCCESS. Probability value = {randomDouble}"); }
public static DomainMessage AddEvent(SomethingHappenedEvent e) { var lastEvent = Events.Last(); var newEvent = new DomainMessage( new MessageHeader( lastEvent.Header.MessageNumber + 1, DateTimeOffset.UtcNow, SomethingHappenedEvent.DomainMessageType, null, null ), e ); Events.Add(newEvent); return(newEvent); }
// hence, valid event stream will be: // 0,9 // 10,19 // 20,29 static TestStreamRepository() { DateTimeOffset baseTimestamp = DateTimeOffset.UtcNow; Events = Enumerable.Range(0, InitialEventsInStream) .Select(x => { var evt = new SomethingHappenedEvent { Description = $"Event{x}" }; return(new DomainMessage( new MessageHeader( x, baseTimestamp.AddSeconds(x), SomethingHappenedEvent.DomainMessageType, null, null ), evt )); }) .ToList(); }
protected override void Context() { _eventConversionRunner = new EventConversionRunner(_eventConverterFactory.Object); _somethingHappenedEvent = _eventFactory.Create<SomethingHappenedEvent>(e => {}); _somethingElseHappenedEvent = _eventFactory.Create<SomethingElseHappenedEvent>(e => {}); _eventConverterFactory.Setup(f => f.Get(typeof(SomethingHappenedEvent))).Returns(e => { _convertedEvents.Add((IEvent)e); return _somethingElseHappenedEvent; }); }
protected override void Context() { _eventConversionRunner = new EventConversionRunner(_eventConverterFactory.Object); _somethingHappenedEvent = _eventFactory.Create<SomethingHappenedEvent>(e => {}); }
private void Handle(SomethingHappenedEvent @event) { HandledEvents.Add(@event); _something = @event.Something; }
private void Handle(SomethingHappenedEvent @event) { HandledEvents.Add(@event); _something = @event.Something; }
protected void OnSomethingHappened(SomethingHappenedEvent evt) { OnSomethingHappenedCalled = true; }
protected override void Context() { _eventConversionRunner = new EventConversionRunner(_eventConverterFactory.Object); _somethingHappenedEvent = _eventFactory.Create <SomethingHappenedEvent>(e => {}); }
public Task Handle(SomethingHappenedEvent message, IMessageHandlerContext context) { Data.DataId = message.DataId; //Request a timeout return(RequestTimeout <Saga2Timeout>(context, TimeSpan.FromMilliseconds(1))); }
protected override void Context() { _event = _eventFactory.Create<SomethingHappenedEvent>(e => {}); }
protected void Apply(SomethingHappenedEvent evt) { }