public IActionResult Post( [FromBody] RegisterUserDto dto, [FromServices] IRegisterUserCommand command) { _executor.ExecuteCommand(command, dto); return(StatusCode(StatusCodes.Status201Created)); }
public UsersController( IRegisterUserCommand registerUserCommand, IInactivateUserCommand inactivateUserCommand, IUSerProfileQuery userProfileQuery) { _registerUsersCommand = registerUserCommand; _inactivateUserCommand = inactivateUserCommand; _userProfileQuery = userProfileQuery; }
public UsersController( IGetUsersCommand getUsersCommand, IGetUserCommand getUserCommand, IRegisterUserCommand registerUserCommand) { _getUsersCommand = getUsersCommand; _getUserCommand = getUserCommand; _registerUserCommand = registerUserCommand; }
private void Consume(IRegisterUserCommand command) { // Store order registration and get id int id = 12; Console.WriteLine($"Order with id {id} registered"); Console.WriteLine("Publishing order registered event"); //notify subscribers that a order is registered var orderRegisteredEvent = new UserRegisteredEvent(command, id); //publish event _rabbitMqManager.SendUserRegisteredEvent(orderRegisteredEvent); }
public void SendRegisterUserCommand(IRegisterUserCommand command) { // Exchange creation (do nothing if already exists) channel.ExchangeDeclare( exchange: Constants.RegisterUserExchange, type: ExchangeType.Direct); // Queue creation (do nothing if already exists) // durable : queue exists only in memory only and it will not persist to disc // exclusive : created queue exclusive for this connection // autoDelete : automatic delete of queue when the last consumer closes its channel // arguments: advance queue creation (out of scope for now) channel.QueueDeclare( queue: Constants.RegisterUserQueue, durable: false, exclusive: false, autoDelete: false, arguments: null); // Bind between exchange-queue creatation (do nothing if already exists) channel.QueueBind( queue: Constants.RegisterUserQueue, exchange: Constants.RegisterUserExchange, routingKey: ""); var serializedCommand = JsonConvert.SerializeObject(command); var messageProperties = channel.CreateBasicProperties(); messageProperties.ContentType = Constants.JsonMimeType; channel.BasicPublish( exchange: Constants.RegisterUserExchange, basicProperties: messageProperties, routingKey: "", body: Encoding.UTF8.GetBytes(serializedCommand)); }
public void Post([FromBody] RegisterUserDto dto, [FromServices] IRegisterUserCommand command) { executor.ExecuteCommand(command, dto); }
public ViewEventModel(IEventQuery eventQuery, IRegisterUserCommand registerUser) { _eventQuery = eventQuery; _registerUser = registerUser; }
public UserRegisteredEvent(IRegisterUserCommand command, int userId) { this.command = command; this.userId = userId; }
public UserRegisteredEvent(IRegisterUserCommand command, int userId) { _command = command; _userId = userId; }
public void Post([FromBody] RegisterUserDto request, [FromServices] IRegisterUserCommand command) { _executor.ExecuteCommand(command, request); }