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

			if(connectionStates.TryGetValue(id, out connection))
            {
                connection.ConnectionInterruptProcessingComplete = false;
            }
        }
예제 #8
0
        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();
				}
            }
        }