Ejemplo n.º 1
0
        public void renegotiateWireFormat(WireFormatInfo info)
        {
            if (info.Version < minimumVersion)
            {
                throw new IOException("Remote wire format (" + info.Version +") is lower the minimum version required (" + minimumVersion + ")");
            }

            this.Version = Math.Min( PreferedWireFormatInfo.Version, info.Version);
            this.stackTraceEnabled = info.StackTraceEnabled && PreferedWireFormatInfo.StackTraceEnabled;
//            this.tcpNoDelayEnabled = info.TcpNoDelayEnabled && PreferedWireFormatInfo.TcpNoDelayEnabled;
//            this.cacheEnabled = info.CacheEnabled && PreferedWireFormatInfo.CacheEnabled;
            this.tightEncodingEnabled = info.TightEncodingEnabled && PreferedWireFormatInfo.TightEncodingEnabled;
            this.sizePrefixDisabled = info.SizePrefixDisabled && PreferedWireFormatInfo.SizePrefixDisabled;
            
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handle incoming commands
        /// </summary>
        /// <param name="transport">An ITransport</param>
        /// <param name="command">A  Command</param>
        protected void OnCommand(ITransport transport, Command command)
        {
            if (command is MessageDispatch)
            {
                MessageDispatch dispatch = (MessageDispatch) command;
                ConsumerId consumerId = dispatch.ConsumerId;
                MessageConsumer consumer = (MessageConsumer) consumers[consumerId];
                if (consumer == null)
                {
					Tracer.Error("No such consumer active: " + consumerId);
                }
                else
                {
                    ActiveMQMessage message = (ActiveMQMessage) dispatch.Message;
                    consumer.Dispatch(message);
                }
            }
            else if (command is WireFormatInfo)
            {
                this.brokerWireFormatInfo = (WireFormatInfo) command;
            }
            else if (command is BrokerInfo)
            {
                this.brokerInfo = (BrokerInfo) command;
            }
            else if (command is ShutdownInfo)
            {
                //ShutdownInfo info = (ShutdownInfo)command;
                if( !closing && !closed )
                {
                    OnException(transport, new NMSException("Broker closed this connection."));
                }
            }
            else
            {
                Tracer.Error("Unknown command: " + command);
            }
        }