/// <summary> /// Creer un consumer pour la queue system /// </summary> public void CreateConsumerSystem() { var consumer = new EventingBasicConsumer(Channel); consumer.Received += (model, ea) => { var body = ea.Body; var json = Encoding.UTF8.GetString(body); Log.Info("Le consumer " + consumer.ConsumerTag + " a recu le message systeme: " + json); MessageRabbit.processingMessage(this.Context, json, "system"); }; Channel.BasicConsume(queue: QUEUE_NAME_SYSTEM, autoAck: true, consumer: consumer); }
/// <summary> /// Creation du consumer pour la queue Abonnement de RabbitMQ qui recupere les messages routes pour son l'id de son service /// </summary> /// <param name="idService">l'id du service de l'utilisateur</param> /// <returns></returns> public void CreateConsumerSubscribing(string idService) { var consumer = new EventingBasicConsumer(Channel); consumer.Received += (model, ea) => { var body = ea.Body; var json = Encoding.UTF8.GetString(body); //on recupere le fax en json var routingKey = ea.RoutingKey; MessageRabbit.processingMessage(this.Context, json, "subscribing"); }; Channel.BasicConsume(queue: QUEUE_NAME_SUBSCRIBING, autoAck: true, consumer: consumer); }