public Task Handle(Updates.Update e, IHandleContext ctx) { // Todo: Etags and timestamp _manager.Publish(e.Payload, e.ChangeType); return(Task.FromResult(0)); }
public static void ResultAsync <TResponse>(this IHandleContext context, TResponse Payload, String ETag = "") where TResponse : class { context.ReplyAsync <IReply>(x => { x.ETag = ETag; x.Payload = Payload; }); }
public Task HandleAsync(HelloNewSchemaIntegrationEvent @event, IHandleContext context, object sender) { this.logger.LogInformation($"Handling {nameof(HelloNewSchemaIntegrationEvent)}"); context.Commit(); return(Task.CompletedTask); }
protected override async Task Handle(IHandleContext context, RegisterBotProcessingMessage message) { await botManager.GetBotAsync(message.BotEngine, message.BotKey); MasterProcessId = message.MasterProcessId; ChatProcessIdentity = message.ChatProcessIdentity; CorrelationId.Value = message.CorrelationId.Value; }
public async Task Handle(Commands.ChangeParent command, IHandleContext ctx) { var account = await _uow.For <Account>().Get(command.AccountId); var parent = await _uow.For <Account>().Get(command.ParentId); account.ChangeParent(parent); }
public async Task Handle(Commands.ChangeType command, IHandleContext ctx) { var account = await _uow.For <Account>().Get(command.AccountId); var accountType = await _uow.For <Configuration.AccountType.AccountType>().Get(command.TypeId); account.ChangeType(accountType); }
public async Task Handle(Commands.Activate command, IHandleContext ctx) { var currency = await _uow.For <Currency>().Get(command.CurrencyId); var user = await _uow.For <Authentication.Users.User>().Get(command.UserId); currency.Activate(user); }
public async Task Handle(Commands.AddRate command, IHandleContext ctx) { var currency = await _uow.For <Currency>().Get(command.CurrencyId); var destination = await _uow.For <Currency>().Get(command.DestinationCurrencyId); currency.AddRate(command.Factor, destination, command.EffectiveTill); }
public async Task Handle(Commands.Create command, IHandleContext ctx) { var user = await _uow.For <Authentication.Users.User>().Get(command.UserId); var currency = await _uow.For <Currency>().New(command.CurrencyId); currency.Create(command.Code, command.Name, command.Symbol, command.SymbolBefore, command.RoundingFactor, command.ComputationalAccuracy, command.Format, command.Fraction); }
public async Task Handle(Deactivated e, IHandleContext ctx) { var get = await _uow.Get <presentationUsers.Models.AU_UserResponse>(e.UserAuthId); get.LockedDate = DateTime.UtcNow; _uow.Save(get); ctx.UpdateAsync(get, ChangeType.CHANGE); }
public static void ResultAsync <TResponse>(this IHandleContext context, IEnumerable <TResponse> Records, Int64 Total, Int64 ElapsedMs) where TResponse : class { context.ReplyAsync <IPagedReply>(x => { x.Records = Records.ToList(); x.Total = Total; x.ElapsedMs = ElapsedMs; }); }
public async Task Handle(RolesUnassigned e, IHandleContext ctx) { var get = await _uow.Get <presentationUsers.Models.AU_UserResponse>(e.UserAuthId); get.Roles = get.Roles.Except(e.Roles).Distinct(); _uow.Save(get); ctx.UpdateAsync(get, ChangeType.CHANGE); }
public async Task Handle(EmailChanged e, IHandleContext ctx) { var get = await _uow.Get <presentationUsers.Models.AU_UserResponse>(e.UserId); get.Email = e.Email; _uow.Save(get); ctx.UpdateAsync(get, ChangeType.CHANGE); }
protected override Task Handle(IHandleContext context, WaitMessageMessage message) { BookmarkId = message.BookmarkId; BotEngine = message.BotEngine; BotKey = message.BotKey; CorrelationId.Value = message.CorrelationId.Value; IsWaiting = true; return(Task.CompletedTask); }
public async Task Handle(Commands.Create command, IHandleContext ctx) { var account = await _uow.For <Account>().New(command.AccountId); var currency = await _uow.For <Currency.Currency>().Get(command.CurrencyId); var store = await _uow.For <Relations.Store.Store>().Get(command.StoreId); account.Create(command.Code, command.Name, command.AcceptPayments, command.AllowReconcile, command.Operation, currency, store); }
public static void UpdateAsync(this IHandleContext context, Object Payload, ChangeType ChangeType, String ETag = "") { context.SendAsync <Updates.Update>(ServiceStackEndpoint, x => { x.Payload = Payload; x.ChangeType = ChangeType; x.ETag = ETag; x.Timestamp = DateTime.UtcNow; }); }
public Task Handle(ChangeLogLevel message, IHandleContext context) { foreach (var rule in LogManager.Configuration.LoggingRules) { rule.EnableLoggingForLevel(message.Level); } LogManager.ReconfigExistingLoggers(); return(Task.FromResult(0)); }
public async Task Handle(LoggedOut e, IHandleContext ctx) { var user = await _uow.Get <presentationUsers.Models.AU_UserResponse>(e.UserId); if (user == null) { return; } _Demo.Report("Logout", new { Name = user.Name, Id = user.Id, Email = user.Email }); }
public async Task Handle(LoggedIn e, IHandleContext ctx) { var get = await _uow.Get <presentationUsers.Models.AU_UserResponse>(e.UserId); get.LastLoginAttempt = DateTime.UtcNow; _uow.Save(get); ctx.UpdateAsync(get, ChangeType.CHANGE); _Demo.Report("Login", new { Name = get.Name, Id = get.Id, Email = get.Email }); }
public async Task Handle(Updated e, IHandleContext ctx) { var get = await _uow.Get <presentationUsers.Models.AU_UserResponse>(e.UserAuthId); get.Name = e.DisplayName; get.Email = e.PrimaryEmail; get.Nickname = e.Nickname; get.Timezone = e.Timezone; get.ModifiedDate = DateTime.UtcNow; _uow.Save(get); ctx.UpdateAsync(get, ChangeType.CHANGE); }
public Task Handle(Registered e, IHandleContext ctx) { var get = new presentationUsers.Models.AU_UserResponse { Id = e.UserAuthId, Password = e.Password }; _uow.Save(get); ctx.UpdateAsync(get, ChangeType.NEW); return(Task.FromResult(0)); }
public async Task <IHandleResult> Handle(IHandleContext <T> context) { if (context.Result.Success || _behavior.Mode == HandleMode.Anyway) { return(await _handler.Handle(context).ConfigureAwait(false)); } if (_behavior.Mode == HandleMode.OnError) { await HandleError(context).ConfigureAwait(false); } return(new HandleResult()); }
public Task <IHandleResult> Handle(IHandleContext <string> context) { var result = new HandleResult(); var value = context.Value; if (value.Contains("Foo")) { Console.Out.WriteLine($"Foo: {value}"); } else { result.Errors.Add($"Failed in Foo: {value}"); } return(Task.FromResult((IHandleResult)result)); }
public async Task HandleAsync(HelloWorldIntegrationEvent @event, IHandleContext context, object sender) { this.logger.LogInformation($"New integration event received! value: '{@event.Value}'"); this.logger.LogInformation("----------Message metadata----------"); this.logger.LogInformation($"Id: {context.MessageContext.Id}"); this.logger.LogInformation($"SentTime: {context.MessageContext.SentTime}"); this.logger.LogInformation($"Name: {context.MessageContext.Name}"); this.logger.LogInformation($"Group: {context.MessageContext.Group}"); // Any operation await Task.Delay(TimeSpan.FromSeconds(1)); this.logger.LogInformation("Set message as commited..."); context.Commit(context.MessageContext.Messsage.ConsumerResult); }
public async Task <IHandleResult> Execute(IHandleContext <T> context) { if (!_pipeline.Any()) { throw new InvalidOperationException($"{nameof(Pipeline<T>)} has not been configured."); } foreach (var handler in _pipeline) { var handleResult = await handler.Handle(context).ConfigureAwait(false); foreach (var error in handleResult.Errors) { context.Result.Errors.Add(error); } } return(context.Result); }
protected override Task Handle(IHandleContext context, IncomeMessage message) { if (IsWaiting) { var msg = new ResumeBookmarkMessage(BookmarkId, DynamicObjectConverters.From(message)); context.SendMessage(msg); IsComplete = true; } else { var m = new InitBotChatMessage(message.BotEngine, message.BotKey) { ChatId = message.CorrelationId.Value, Message = message.Message }; context.SendMessage(m); IsComplete = true; } return(Task.CompletedTask); }
protected override Task Handle(IHandleContext context, InitBotChatMessage message) { var sp = new StartProcessMessage { ParentId = MasterProcessId, ProcessId = ChatProcessIdentity, Parameters = DynamicObjectConverters.From(message) }; var m = new IncomeMessage(message.ChatId) { BotEngine = message.BotEngine, BotKey = message.BotKey, Message = message.Message }; context.SendMessagesSequence(sp, m); return(Task.CompletedTask); }
public async Task <MessageState[]> Handle(PreviousMessages query, IHandleContext context) { var uow = context.UoW; // Can use uow to get domain entities var world = await uow.For <World>().TryGet("World"); if (world == null) { return new MessageState[] { } } ; var states = new List <MessageState>(); foreach (var id in MessageIds) { var message = await world.For <Message>().Get(id).ConfigureAwait(false); states.Add(message.State); } return(states.ToArray()); } }
public Task Handle(Update e, IHandleContext ctx) { return _manager.Publish(e.Payload, e.ChangeType); }
public async Task Handle(Commands.Destroy command, IHandleContext ctx) { var account = await _uow.For <AccountType>().Get(command.AccountTypeId); account.Destroy(); }