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 SendProcessingSucceededEvent(ProcessingSucessEvent @event) { _channel.ExchangeDeclare(exchange: RabbitMqConstants.ProcessSuccessExchange, type: ExchangeType.Fanout); _channel.QueueDeclare(queue: RabbitMqConstants.ProcessSuccessQueue, durable: false, exclusive: false, autoDelete: false, arguments: null); _channel.QueueBind(queue: RabbitMqConstants.ProcessSuccessQueue, exchange: RabbitMqConstants.ProcessSuccessExchange, routingKey: ""); var serializedCommand = JsonConvert.SerializeObject(@event); var properties = _channel.CreateBasicProperties(); properties.ContentType = RabbitMqConstants.JsonMimeType; _channel.BasicPublish(exchange: RabbitMqConstants.ProcessSuccessExchange, routingKey: "", basicProperties: properties, body: Encoding.UTF8.GetBytes(serializedCommand)); }