Inheritance: BaseDataStructure
Example #1
0
        public Connection(Uri connectionUri, ITransport transport, IdGenerator clientIdGenerator)
        {
            this.brokerUri = connectionUri;
            this.clientIdGenerator = clientIdGenerator;

            this.transport = transport;
            this.transport.Command = new CommandHandler(OnCommand);
            this.transport.Exception = new ExceptionHandler(OnTransportException);
            this.transport.Interrupted = new InterruptedHandler(OnTransportInterrupted);
            this.transport.Resumed = new ResumedHandler(OnTransportResumed);

            ConnectionId id = new ConnectionId();
            id.Value = CONNECTION_ID_GENERATOR.GenerateId();

            this.info = new ConnectionInfo();
            this.info.ConnectionId = id;
            this.info.FaultTolerant = transport.IsFaultTolerant;

            this.messageTransformation = new ActiveMQMessageTransformation(this);
        }
 public void TransportInterrupted(ConnectionId id)
 {
     ConnectionState connection = connectionStates[id];
     if(connection != null)
     {
         connection.ConnectionInterruptProcessingComplete = false;
     }
 }
Example #3
0
 public void ConnectionInterruptProcessingComplete(ConnectionId connectionId)
 {
     lock(reconnectMutex)
     {
         Tracer.Debug("Connection Interrupt Processing is complete for ConnectionId: " + connectionId);
         stateTracker.ConnectionInterruptProcessingComplete(this, connectionId);
     }
 }
 public override Response processRemoveConnection(ConnectionId id)
 {
     if(id != null)
     {
         connectionStates.Remove(id);
     }
     return TRACKED_RESPONSE_MARKER;
 }
        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();
            }
        }
 public virtual Response processRemoveConnection(ConnectionId id)
 {
     return null;
 }
        public void TransportInterrupted(ConnectionId id)
        {
			ConnectionState connection = null;

			if(connectionStates.TryGetValue(id, out connection))
            {
                connection.ConnectionInterruptProcessingComplete = false;
            }
        }
        public void ConnectionInterruptProcessingComplete(ITransport transport, ConnectionId connectionId)
        {
			ConnectionState connectionState = null;

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

				lock(((ICollection) connectionState.RecoveringPullConsumers).SyncRoot)
				{
					foreach(KeyValuePair<ConsumerId, ConsumerInfo> entry in connectionState.RecoveringPullConsumers)
					{
						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);
							}
						}
					}
					connectionState.RecoveringPullConsumers.Clear();
				}
            }
        }