コード例 #1
0
        internal async Task <VoteLbResponse> VoteAction(ChooserLbMessage chooser)
        {
            var distribuitor = new Distributor(new VoteSender());

            distribuitor.FormateNodeList(3);
            var message = distribuitor.FormateMessage(chooser);

            var response = await distribuitor.Send(distribuitor.Executor, message);

            try
            {
                var voteresponse = JsonConvert.DeserializeObject <NodeVoteResponse>(response);
                return(new VoteLbResponse
                {
                    Status = voteresponse.Status,
                    Block = voteresponse.Block,
                    Message = voteresponse.Message,
                    ProcessedTime = voteresponse.ProcessedTime
                });
            }
            catch (AggregateException ex)
            {
                return(new VoteLbResponse {
                    Status = false, Message = "Eroare de conectare la server LB:" + ex.InnerException.ToString(), ProcessedTime = DateTime.Now
                });
            }
        }