public void Consume(IProcessingSuccessEvent command) { _store.Record(command.Client, command.Id, command.Keywords); var processEndEvent = new ProcessEndEvent { DocumentName = command.DocumentName, Client = command.Client }; _manager.SendProcessEndEvent(processEndEvent); }
public void SendProcessEndEvent(ProcessEndEvent @event) { _channel.ExchangeDeclare(exchange: RabbitMqConstants.ProcessEndExchange, type: ExchangeType.Fanout); _channel.QueueDeclare(queue: RabbitMqConstants.ProcessEndQueue, durable: false, exclusive: false, autoDelete: false, arguments: null); _channel.QueueBind(queue: RabbitMqConstants.ProcessEndQueue, exchange: RabbitMqConstants.ProcessEndExchange, routingKey: ""); var serializedCommand = JsonConvert.SerializeObject(@event); var properties = _channel.CreateBasicProperties(); properties.ContentType = RabbitMqConstants.JsonMimeType; _channel.BasicPublish(exchange: RabbitMqConstants.ProcessEndExchange, routingKey: "", basicProperties: properties, body: Encoding.UTF8.GetBytes(serializedCommand)); }