Exemplo n.º 1
0
        public async Task lookupNearby_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
        {
            var args = new lookupNearbyArgs();
            await args.ReadAsync(iprot, cancellationToken);

            await iprot.ReadMessageEndAsync(cancellationToken);

            var result = new lookupNearbyResult();

            try
            {
                try
                {
                    result.Success = await _iAsync.lookupNearbyAsync(args.Location, args.Category, args.Query, args.CountryAreaCode, cancellationToken);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                await oprot.WriteMessageBeginAsync(new TMessage("lookupNearby", TMessageType.Reply, seqid), cancellationToken);

                await result.WriteAsync(oprot, cancellationToken);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                await oprot.WriteMessageBeginAsync(new TMessage("lookupNearby", TMessageType.Exception, seqid), cancellationToken);

                await x.WriteAsync(oprot, cancellationToken);
            }
            await oprot.WriteMessageEndAsync(cancellationToken);

            await oprot.Transport.FlushAsync(cancellationToken);
        }
Exemplo n.º 2
0
        public async Task postSnsInvitationMessage_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
        {
            var args = new postSnsInvitationMessageArgs();
            await args.ReadAsync(iprot, cancellationToken);

            await iprot.ReadMessageEndAsync(cancellationToken);

            var result = new postSnsInvitationMessageResult();

            try
            {
                try
                {
                    await _iAsync.postSnsInvitationMessageAsync(args.SnsIdType, args.SnsAccessToken, args.ToSnsUserId, cancellationToken);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                await oprot.WriteMessageBeginAsync(new TMessage("postSnsInvitationMessage", TMessageType.Reply, seqid), cancellationToken);

                await result.WriteAsync(oprot, cancellationToken);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                await oprot.WriteMessageBeginAsync(new TMessage("postSnsInvitationMessage", TMessageType.Exception, seqid), cancellationToken);

                await x.WriteAsync(oprot, cancellationToken);
            }
            await oprot.WriteMessageEndAsync(cancellationToken);

            await oprot.Transport.FlushAsync(cancellationToken);
        }
Exemplo n.º 3
0
        public async Task sendChatCheckedByWatermark_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
        {
            var args = new sendChatCheckedByWatermarkArgs();
            await args.ReadAsync(iprot, cancellationToken);

            await iprot.ReadMessageEndAsync(cancellationToken);

            var result = new sendChatCheckedByWatermarkResult();

            try
            {
                try
                {
                    await _iAsync.sendChatCheckedByWatermarkAsync(args.Seq, args.Mid, args.Watermark, args.SessionId, cancellationToken);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                await oprot.WriteMessageBeginAsync(new TMessage("sendChatCheckedByWatermark", TMessageType.Reply, seqid), cancellationToken);

                await result.WriteAsync(oprot, cancellationToken);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                await oprot.WriteMessageBeginAsync(new TMessage("sendChatCheckedByWatermark", TMessageType.Exception, seqid), cancellationToken);

                await x.WriteAsync(oprot, cancellationToken);
            }
            await oprot.WriteMessageEndAsync(cancellationToken);

            await oprot.Transport.FlushAsync(cancellationToken);
        }
Exemplo n.º 4
0
        public async Task getBotUseInfo_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
        {
            var args = new getBotUseInfoArgs();
            await args.ReadAsync(iprot, cancellationToken);

            await iprot.ReadMessageEndAsync(cancellationToken);

            var result = new getBotUseInfoResult();

            try
            {
                try
                {
                    result.Success = await _iAsync.getBotUseInfoAsync(args.BotMid, cancellationToken);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                await oprot.WriteMessageBeginAsync(new TMessage("getBotUseInfo", TMessageType.Reply, seqid), cancellationToken);

                await result.WriteAsync(oprot, cancellationToken);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                await oprot.WriteMessageBeginAsync(new TMessage("getBotUseInfo", TMessageType.Exception, seqid), cancellationToken);

                await x.WriteAsync(oprot, cancellationToken);
            }
            await oprot.WriteMessageEndAsync(cancellationToken);

            await oprot.Transport.FlushAsync(cancellationToken);
        }
Exemplo n.º 5
0
        public async Task fetchMessageOperations_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
        {
            var args = new fetchMessageOperationsArgs();
            await args.ReadAsync(iprot, cancellationToken);

            await iprot.ReadMessageEndAsync(cancellationToken);

            var result = new fetchMessageOperationsResult();

            try
            {
                try
                {
                    result.Success = await _iAsync.fetchMessageOperationsAsync(args.LocalRevision, args.LastOpTimestamp, args.Count, cancellationToken);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                await oprot.WriteMessageBeginAsync(new TMessage("fetchMessageOperations", TMessageType.Reply, seqid), cancellationToken);

                await result.WriteAsync(oprot, cancellationToken);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                await oprot.WriteMessageBeginAsync(new TMessage("fetchMessageOperations", TMessageType.Exception, seqid), cancellationToken);

                await x.WriteAsync(oprot, cancellationToken);
            }
            await oprot.WriteMessageEndAsync(cancellationToken);

            await oprot.Transport.FlushAsync(cancellationToken);
        }
        public async Task notify_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
        {
            var args = new notifyArgs();
            await args.ReadAsync(iprot, cancellationToken);

            await iprot.ReadMessageEndAsync(cancellationToken);

            var result = new notifyResult();

            try
            {
                try
                {
                    await _iAsync.notifyAsync(args.Event, cancellationToken);
                }
                catch (UniversalNotificationServiceException e)
                {
                    result.E = e;
                }
                await oprot.WriteMessageBeginAsync(new TMessage("notify", TMessageType.Reply, seqid), cancellationToken);

                await result.WriteAsync(oprot, cancellationToken);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                await oprot.WriteMessageBeginAsync(new TMessage("notify", TMessageType.Exception, seqid), cancellationToken);

                await x.WriteAsync(oprot, cancellationToken);
            }
            await oprot.WriteMessageEndAsync(cancellationToken);

            await oprot.Transport.FlushAsync(cancellationToken);
        }
Exemplo n.º 7
0
            public async Task calculate_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
            {
                var args = new calculateArgs();
                await args.ReadAsync(iprot, cancellationToken);

                await iprot.ReadMessageEndAsync(cancellationToken);

                var result = new calculateResult();

                try
                {
                    try
                    {
                        result.Success = await _iAsync.calculateAsync(args.Logid, args.W, cancellationToken);
                    }
                    catch (InvalidOperation ouch)
                    {
                        result.Ouch = ouch;
                    }
                    await oprot.WriteMessageBeginAsync(new TMessage("calculate", TMessageType.Reply, seqid), cancellationToken);

                    await result.WriteAsync(oprot, cancellationToken);
                }
                catch (TTransportException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred in processor:");
                    Console.Error.WriteLine(ex.ToString());
                    var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                    await oprot.WriteMessageBeginAsync(new TMessage("calculate", TMessageType.Exception, seqid), cancellationToken);

                    await x.WriteAsync(oprot, cancellationToken);
                }
                await oprot.WriteMessageEndAsync(cancellationToken);

                await oprot.Transport.FlushAsync(cancellationToken);
            }
        public async Task <bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
        {
            try
            {
                var msg = await iprot.ReadMessageBeginAsync(cancellationToken);

                ProcessFunction fn;
                processMap_.TryGetValue(msg.Name, out fn);

                if (fn == null)
                {
                    await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken);

                    await iprot.ReadMessageEndAsync(cancellationToken);

                    var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, "Invalid method name: '" + msg.Name + "'");
                    await oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), cancellationToken);

                    await x.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteMessageEndAsync(cancellationToken);

                    await oprot.Transport.FlushAsync(cancellationToken);

                    return(true);
                }

                await fn(msg.SeqID, iprot, oprot, cancellationToken);
            }
            catch (IOException)
            {
                return(false);
            }

            return(true);
        }