public void Handle(CustomerSetPreferredEvent message) { //Note that the saga is meant to handle one or more of these messages, updating the saga timeout and EndsAt value. this.Data.UserId = message.UserId; this.Data.EndsAt = message.EndsAt; this.Data.TimeoutGroupId = Guid.NewGuid(); SetupTimeout(this.Data.TimeoutGroupId, this.Data.EndsAt.AddDays(-3), FIRST_WARNING); SetupTimeout(this.Data.TimeoutGroupId, this.Data.EndsAt.AddDays(-1), SECOND_WARNING); SetupTimeout(this.Data.TimeoutGroupId, this.Data.EndsAt, TIMEOUT); }
public void Handle(CustomerSetPreferredEvent message) { if (message.IsExtension) { var msg = new SetCustomerPreferredCommand { DaysAhead = Data.DaysOfBonus, UserId = Data.UserId }; Bus.Send(msg); } //Remember, the action above will result in ANOTHER extension. //We there make sure to mark the saga as complete, so that the bonus will not create another bonus. //Of course, it should be marked complete anyways, but still.. MarkAsComplete(); }