public async Task SendUserRegistrationAsync(Guid userId, string userName, string email)
        {
            if (userId == Guid.Empty)
            {
                throw new ArgumentException($"{nameof(userId)} cannot be an empty guid");
            }

            if (string.IsNullOrWhiteSpace(userName))
            {
                throw new ArgumentException($"{nameof(userName)} cannot be empty");
            }

            if (string.IsNullOrWhiteSpace(email))
            {
                throw new ArgumentException($"{nameof(email)} cannot be empty");
            }

            var messageToBeEncoded = new { UserId = userId, UserName = userName, Email = email };

            var message = new Message(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(messageToBeEncoded)));

            await _topicClient.SendAsync(message);
        }
Example #2
0
 public Task SendAsync(ICommand command)
 {
     return(_serviceBusClient.SendAsync(command));
 }