コード例 #1
0
        //
        // Write a object instance to data output stream
        //
        public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
        {
            ConsumerControl info = (ConsumerControl)o;

            base.LooseMarshal(wireFormat, o, dataOut);
            dataOut.Write(info.Close);
            LooseMarshalNestedObject(wireFormat, (DataStructure)info.ConsumerId, dataOut);
            dataOut.Write(info.Prefetch);
        }
コード例 #2
0
        //
        // 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);

            ConsumerControl info = (ConsumerControl)o;

            info.Close      = dataIn.ReadBoolean();
            info.ConsumerId = (ConsumerId)LooseUnmarshalNestedObject(wireFormat, dataIn);
            info.Prefetch   = dataIn.ReadInt32();
        }
コード例 #3
0
        //
        // Write a object instance to data output stream
        //
        public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
        {
            base.TightMarshal2(wireFormat, o, dataOut, bs);

            ConsumerControl info = (ConsumerControl)o;

            bs.ReadBoolean();
            TightMarshalNestedObject2(wireFormat, (DataStructure)info.ConsumerId, dataOut, bs);
            dataOut.Write(info.Prefetch);
        }
コード例 #4
0
        //
        // 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);

            ConsumerControl info = (ConsumerControl)o;

            info.Close      = bs.ReadBoolean();
            info.ConsumerId = (ConsumerId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
            info.Prefetch   = dataIn.ReadInt32();
        }
コード例 #5
0
        //
        // Write the booleans that this object uses to a BooleanStream
        //
        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
        {
            ConsumerControl info = (ConsumerControl)o;

            int rc = base.TightMarshal1(wireFormat, info, bs);

            bs.WriteBoolean(info.Close);
            rc += TightMarshalNestedObject1(wireFormat, (DataStructure)info.ConsumerId, bs);

            return(rc + 4);
        }
コード例 #6
0
        public void ConnectionInterruptProcessingComplete(ITransport transport, ConnectionId connectionId)
        {
            ConnectionState connectionState = null;

            if (connectionStates.TryGetValue(connectionId, out connectionState))
            {
                connectionState.ConnectionInterruptProcessingComplete = true;

                Dictionary <ConsumerId, ConsumerInfo> consumersToRestorePrefetchOn;

                lock (((ICollection)connectionState.RecoveringPullConsumers).SyncRoot)
                {
                    consumersToRestorePrefetchOn = new Dictionary <ConsumerId, ConsumerInfo>(connectionState.RecoveringPullConsumers);
                    connectionState.RecoveringPullConsumers.Clear();
                }

                foreach (KeyValuePair <ConsumerId, ConsumerInfo> entry in consumersToRestorePrefetchOn)
                {
                    ConsumerControl control = new ConsumerControl();
                    control.ConsumerId  = entry.Key;
                    control.Prefetch    = entry.Value.PrefetchSize;
                    control.Destination = entry.Value.Destination;
                    try
                    {
                        if (Tracer.IsDebugEnabled)
                        {
                            Tracer.Debug("restored recovering consumer: " + control.ConsumerId +
                                         " with: " + control.Prefetch);
                        }
                        transport.Oneway(control);
                    }
                    catch (Exception ex)
                    {
                        if (Tracer.IsDebugEnabled)
                        {
                            Tracer.Debug("Failed to submit control for consumer: " + control.ConsumerId +
                                         " with: " + control.Prefetch + "Error: " + ex.Message);
                        }
                    }
                }
            }
        }
コード例 #7
0
        public void ConnectionInterruptProcessingComplete(ITransport transport, ConnectionId connectionId)
        {
            ConnectionState connectionState = connectionStates[connectionId];

            if (connectionState != null)
            {
                connectionState.ConnectionInterruptProcessingComplete = true;

                Dictionary <ConsumerId, ConsumerInfo> stalledConsumers = connectionState.RecoveringPullConsumers;
                foreach (KeyValuePair <ConsumerId, ConsumerInfo> entry in stalledConsumers)
                {
                    ConsumerControl control = new ConsumerControl();
                    control.ConsumerId  = entry.Key;
                    control.Prefetch    = entry.Value.PrefetchSize;
                    control.Destination = entry.Value.Destination;
                    try
                    {
                        if (Tracer.IsDebugEnabled)
                        {
                            Tracer.Debug("restored recovering consumer: " + control.ConsumerId +
                                         " with: " + control.Prefetch);
                        }
                        transport.Oneway(control);
                    }
                    catch (Exception ex)
                    {
                        if (Tracer.IsDebugEnabled)
                        {
                            Tracer.Debug("Failed to submit control for consumer: " + control.ConsumerId +
                                         " with: " + control.Prefetch + "Error: " + ex.Message);
                        }
                    }
                }
                stalledConsumers.Clear();
            }
        }
コード例 #8
0
 public virtual Response processConsumerControl(ConsumerControl control)
 {
     return(null);
 }
コード例 #9
0
 public Consumer()
 {
     Control = new ConsumerControl();
     BackEnd.Current.OnDataChanged += NotifyConsumer;
     Control.OnTextChanged += OnTextBoxDataChanged;
 }