Inheritance: BaseDataStructure
Exemplo n.º 1
0
        public Session(Connection connection, SessionId sessionId, AcknowledgementMode acknowledgementMode)
        {
            this.info = new SessionInfo();
            this.info.SessionId = sessionId;
            this.connection = connection;
            this.connection.Oneway(this.info);

            this.acknowledgementMode = acknowledgementMode;
            this.requestTimeout = connection.RequestTimeout;
            this.dispatchAsync = connection.DispatchAsync;
            this.transactionContext = new TransactionContext(this);

            Uri brokerUri = connection.BrokerUri;

            // Set propertieDs on session using parameters prefixed with "session."
            if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")"))
            {
                string query = brokerUri.Query.Substring(brokerUri.Query.LastIndexOf(")") + 1);
                StringDictionary options = URISupport.ParseQuery(query);
                options = URISupport.GetProperties(options, "session.");
                URISupport.SetProperties(this, options);
            }

            this.ConsumerTransformer = connection.ConsumerTransformer;
            this.ProducerTransformer = connection.ProducerTransformer;

            this.executor = new SessionExecutor(this, this.consumers);

            if(connection.IsStarted)
            {
                this.Start();
            }

            connection.AddSession(this);
        }
Exemplo n.º 2
0
 public ProducerId( SessionId sessionId, long consumerId )
 {
     this.connectionId = sessionId.ConnectionId;
     this.sessionId = sessionId.Value;
     this.value = consumerId;
 }
Exemplo n.º 3
0
 public NetTxSession(Connection connection, SessionId id)
     : base(connection, id, AcknowledgementMode.AutoAcknowledge)
 {
     TransactionContext.InitializeDtcTxContext();
 }
Exemplo n.º 4
0
 public override Response processRemoveSession(SessionId id)
 {
     if(id != null)
     {
         ConnectionId connectionId = id.ParentId;
         if(connectionId != null)
         {
             ConnectionState cs = connectionStates[connectionId];
             if(cs != null)
             {
                 cs.removeSession(id);
             }
         }
     }
     return TRACKED_RESPONSE_MARKER;
 }
Exemplo n.º 5
0
 public virtual Response processRemoveSession(SessionId id)
 {
     return null;
 }
Exemplo n.º 6
0
        public override Response processRemoveSession(SessionId id)
        {
            if(id != null)
            {
                ConnectionId connectionId = id.ParentId;
                if(connectionId != null)
                {
					ConnectionState cs = null;

					if(connectionStates.TryGetValue(connectionId, out cs))
                    {
                        cs.removeSession(id);
                    }
                }
            }
            return TRACKED_RESPONSE_MARKER;
        }
Exemplo n.º 7
0
 public SessionInfo(ConnectionInfo connectionInfo, long sessionId)
 {
     this.sessionId = new SessionId(connectionInfo.ConnectionId, sessionId);
 }
Exemplo n.º 8
0
 public SessionState removeSession(SessionId id)
 {
     SessionState ret = sessions[id];
     sessions.Remove(id);
     return ret;
 }
Exemplo n.º 9
0
 public SessionState this[SessionId id]
 {
     get
     {
         #if DEBUG
         try
         {
         #endif
             return sessions[id];
         #if DEBUG
         }
         catch(System.Collections.Generic.KeyNotFoundException)
         {
             // Useful for dignosing missing session ids
             string sessionList = string.Empty;
             foreach(SessionId sessionId in sessions.Keys)
             {
                 sessionList += sessionId.ToString() + "\n";
             }
             System.Diagnostics.Debug.Assert(false,
                 string.Format("Session '{0}' did not exist in the sessions collection.\n\nSessions:-\n{1}", id, sessionList));
             throw;
         }
         #endif
     }
 }
Exemplo n.º 10
0
		public SessionState removeSession(SessionId id)
		{
			SessionState ret = null;

			sessions.TryGetValue(id, out ret);
			sessions.Remove(id);
			return ret;
		}
Exemplo n.º 11
0
		public SessionState this[SessionId id]
		{
			get
			{
				SessionState sessionState;

				if(sessions.TryGetValue(id, out sessionState))
				{
					return sessionState;
				}

#if DEBUG
				// Useful for dignosing missing session ids
				string sessionList = string.Empty;
				foreach(SessionId sessionId in sessions.Keys)
				{
					sessionList += sessionId.ToString() + "\n";
				}

				System.Diagnostics.Debug.Assert(false,
					string.Format("Session '{0}' did not exist in the sessions collection.\n\nSessions:-\n{1}", id, sessionList));
#endif
				return null;
			}
		}
Exemplo n.º 12
0
 public SessionInfo(ConnectionInfo connectionInfo, long sessionId)
 {
     this.sessionId = new SessionId(connectionInfo.ConnectionId, sessionId);
 }