public void Handle(UserCreatedMessage message) { var userLookups = _storage.Get <UserLookup>(message.Dto.Login); userLookups.Clear(); userLookups.Add(message.Dto.ConvertToUserLookup()); }
private UserViewModel CreateUser(UserCreatedMessage user) { return(new UserViewModel { Email = user.Email, Name = user.Name }); }
private async Task SendUserCreatedMessage(string userId) { using var serviceScope = app.ApplicationServices.CreateScope(); var publisher = serviceScope.ServiceProvider.GetRequiredService <IBus>(); var message = new UserCreatedMessage { UserId = userId }; await publisher.Publish(message); }
public async Task <IActionResult> Create(User user) { var message = new UserCreatedMessage() { FirstName = user.FirstName, LastName = user.LastName, UserName = $"{user.FirstName}{user.LastName}" }; await MessageProducer.SendAsync(message, "users.created"); Console.WriteLine("Message sent: \n" + JsonSerializer.Serialize(message)); return(Ok()); }
public UserCreatedMessageEventArgs(UserCreatedMessage newUser) { User = newUser; }
public void HandleMessage(UserCreatedMessage userCreatedMessage) { }
public void Handle(UserCreatedMessage message) { Create(message.Dto); }