internal Dictionary <string, object> ConsumeOneMessage(string Queue) { QueueingBasicConsumer fileConsumer = new QueueingBasicConsumer(channel); channel.BasicConsume(queue: Queue, noAck: true, consumer: fileConsumer); var ea = (BasicDeliverEventArgs)fileConsumer.Queue.Dequeue(); return(JSONManipulator.getResponseDictionary(ea.Body)); }
public Dictionary <String, Object> getResponse(String corrId) { var ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue(); if (ea.BasicProperties.CorrelationId == corrId) { return(JSONManipulator.getResponseDictionary(ea.Body)); } else { return(null); } }
public void consumeFile(string Queue, int noOfBlocks, string hash, File file) { QueueingBasicConsumer fileConsumer = new QueueingBasicConsumer(channel); channel.BasicConsume(queue: Queue, noAck: true, consumer: fileConsumer); for (int i = 0; i < noOfBlocks; i++) { var ea = (BasicDeliverEventArgs)fileConsumer.Queue.Dequeue(); Dictionary <string, object> blockInfo = JSONManipulator.getResponseDictionary(ea.Body); object content; blockInfo.TryGetValue("fileBlock", out content); file.appendContent(ObjectToByteArray(content)); } if (file.checkContent(hash)) { //Do something here file.createFileWatcherOnFile(); } }