// // Un-marshal an object instance from the data input stream // public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) { base.TightUnmarshal(wireFormat, o, dataIn, bs); BrokerInfo info = (BrokerInfo)o; info.BrokerId = (BrokerId) TightUnmarshalCachedObject(wireFormat, dataIn, bs); info.BrokerURL = TightUnmarshalString(dataIn, bs); if (bs.ReadBoolean()) { short size = dataIn.ReadInt16(); BrokerInfo[] value = new BrokerInfo[size]; for( int i=0; i < size; i++ ) { value[i] = (BrokerInfo) TightUnmarshalNestedObject(wireFormat,dataIn, bs); } info.PeerBrokerInfos = value; } else { info.PeerBrokerInfos = null; } info.BrokerName = TightUnmarshalString(dataIn, bs); info.SlaveBroker = bs.ReadBoolean(); info.MasterBroker = bs.ReadBoolean(); info.FaultTolerantConfiguration = bs.ReadBoolean(); }
/// <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); } }
// // Un-marshal an object instance from the data input stream // public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn) { base.LooseUnmarshal(wireFormat, o, dataIn); BrokerInfo info = (BrokerInfo)o; info.BrokerId = (BrokerId) LooseUnmarshalCachedObject(wireFormat, dataIn); info.BrokerURL = LooseUnmarshalString(dataIn); if (dataIn.ReadBoolean()) { short size = dataIn.ReadInt16(); BrokerInfo[] value = new BrokerInfo[size]; for( int i=0; i < size; i++ ) { value[i] = (BrokerInfo) LooseUnmarshalNestedObject(wireFormat,dataIn); } info.PeerBrokerInfos = value; } else { info.PeerBrokerInfos = null; } info.BrokerName = LooseUnmarshalString(dataIn); info.SlaveBroker = dataIn.ReadBoolean(); info.MasterBroker = dataIn.ReadBoolean(); info.FaultTolerantConfiguration = dataIn.ReadBoolean(); info.DuplexConnection = dataIn.ReadBoolean(); info.NetworkConnection = dataIn.ReadBoolean(); info.ConnectionId = LooseUnmarshalLong(wireFormat, dataIn); }