public void Consume(IFileLoadRequestCommand command) { var keywords = _handler.HandleDocumentProcessing(command.Content); var processingSuccessEvent = new ProcessingSucessEvent { Client = command.Client, Id = command.FileName.Substring(0, command.FileName.IndexOf("_")), Keywords = keywords, DocumentName = command.FileName }; _manager.SendProcessingSucceededEvent(processingSuccessEvent); }
public void SendFileLoadRequestCommand(IFileLoadRequestCommand command) { _channel.ExchangeDeclare(RabbitMqConstants.FileLoadExchange, ExchangeType.Direct); _channel.QueueDeclare(RabbitMqConstants.FileLoadQueue, durable: false, exclusive: false, autoDelete: false, arguments: null); _channel.QueueBind(RabbitMqConstants.FileLoadQueue, exchange: RabbitMqConstants.FileLoadExchange, routingKey: ""); var serializedCommand = JsonConvert.SerializeObject(command); var properties = _channel.CreateBasicProperties(); properties.ContentType = RabbitMqConstants.JsonMimeType; _channel.BasicPublish(RabbitMqConstants.FileLoadExchange, routingKey: "", basicProperties: properties, body: Encoding.UTF8.GetBytes(serializedCommand)); }