public Task <MessageQueueStatus> PutToQueue(ChatMessageRequestDto message) { var promise = new TaskCompletionSource <MessageQueueStatus>(); messageQueue.Add(new MessageQueueEntry { Promise = promise, Message = message }); return(promise.Task); }
public async Task Send(ChatMessageRequestDto messageDto) { var user = await _userManager.GetUserAsync(Context.User); if (await _roomService.InRoom(user, messageDto.RoomId)) { List <FileModel> attachments; Result <Message> message; if (messageDto.Attachments.Count() == 0) { message = await _messageService.CreateMessage(user, messageDto.RoomId, messageDto.Text); attachments = new List <FileModel>(); } else { var attachmentModels = await _fileService.GetAll(messageDto.Attachments); attachments = attachmentModels.ToList(); message = await _messageService.CreateMessage(user, messageDto.RoomId, messageDto.Text, attachmentModels); } await SendMessage(message.Value, attachments, messageDto.Stamp); } }
public Task <MessageQueueStatus> PutToQueue(ChatMessageRequestDto message) { return(client.PutToQueue(message)); }