Esempio n. 1
0
        public void ConceptRequestHandler()
        {
            var channel  = queues.connection.CreateModel();
            var consumer = new AsyncEventingBasicConsumer(channel);

            consumer.Received += async(model, ea) =>
            {
                Console.WriteLine("Recieved Request for Concepts");
                var body = ea.Body;
                concept_query     = (ConceptRequest)body.DeSerialize(typeof(ConceptRequest));
                this.concept_list = new ConceptResponse(concept_query.Username);
                this.concept_list.concepts.AddRange(graphfunctions.GetConceptFromTechnology(concept_query.Tech));
                channel.BasicAck(ea.DeliveryTag, false);
                channel.BasicPublish("KnowldegeGraphExchange", "Routing Key", null, this.concept_list.Serialize());
                var routingKey = ea.RoutingKey;
                Console.WriteLine(" - Routing Key <{0}>", routingKey);
                Console.WriteLine("- Delivery Tag <{0}>", ea.DeliveryTag);
                await Task.Yield();
            };
            channel.BasicConsume("QuizEngine_KnowledgeGraph_Concepts", false, consumer);
        }
Esempio n. 2
0
 /// <summary>
 /// Returns the <see cref="Uri"/> that gets a concept
 /// </summary>
 public static Uri GetConcepts(ConceptResponse response)
 {
     return("{0}/termbases/{1}/concepts?conceptId={2}".FormatUri(CurrentMultitermUrl, response.TermbaseId, response.ConceptId));
 }