コード例 #1
0
        public void MessageTransfer(IMessage msg)
        {
            MSDecoder decoder = new MSDecoder();

            decoder.Init(msg.Body);
            RangeSet rangeSet = new RangeSet();

            rangeSet.Add(msg.Id);
            char opcode = 'x';
            long seq    = -1;

            while (this.CheckHeader(decoder, out opcode, out seq))
            {
                //log.Debug("Message recieved with opcode " + opcode + " and sequence " + seq) ;
                //log.Debug(System.Text.Encoding.UTF8.GetString(msg.Body.ToArray())) ;
                switch (opcode)
                {
                case 'b':
                    consoleSession.HandleBrokerResponse(this, decoder, seq);
                    break;

                case 'p':
                    consoleSession.HandlePackageIndicator(this, decoder, seq);
                    break;

                case 'z':
                    consoleSession.HandleCommandComplete(this, decoder, seq);
                    break;

                case 'q':
                    consoleSession.HandleClassIndicator(this, decoder, seq);
                    break;

                case 'm':
                    consoleSession.HandleMethodResponse(this, decoder, seq);
                    break;

                case 'h':
                    consoleSession.HandleHeartbeatIndicator(this, decoder, seq, msg);
                    break;

                case 'e':
                    consoleSession.HandleEventIndicator(this, decoder, seq);
                    break;

                case 's':
                    consoleSession.HandleSchemaResponse(this, decoder, seq);
                    break;

                case 'c':
                    consoleSession.HandleContentIndicator(this, decoder, seq, true, false);
                    break;

                case 'i':
                    consoleSession.HandleContentIndicator(this, decoder, seq, false, true);
                    break;

                case 'g':
                    consoleSession.HandleContentIndicator(this, decoder, seq, true, true);
                    break;

                default:
                    log.Error("Invalid message type recieved with opcode " + opcode);
                    break;
                }
            }
            lock (lockObject) {
                outSession.MessageAccept(rangeSet);
            }
        }