コード例 #1
0
        public void ResultSerializationTests()
        {
            CalculationResult res1 = new CalculationResult(ar1, row, time1, id1);
            CalculationResult res2 = CalculationResult.GetFromBytes(CalculationResult.ToBytes(res1));

            Assert.AreEqual(res1, res2);
        }
コード例 #2
0
ファイル: MQClient.cs プロジェクト: margadz/matrix
        public void Run()
        {
            consumer.Received += (model, ea) =>
            {
                var body = ea.Body;
                CalculationResult result = worker.Calculate(UnitOfWork.GetFromBytes(ea.Body));
                var props = ea.BasicProperties;
                var id    = props.CorrelationId;

                channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);
                var b = CalculationResult.ToBytes(result);
                channel.BasicPublish(exchange: "", routingKey: Queues.ReponseQueue, basicProperties: props, body: CalculationResult.ToBytes(result));
            };
            Console.ReadLine();
        }