Inheritance: BaseCommand
コード例 #1
0
ファイル: Session.cs プロジェクト: Redi0/meijing-ui
        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);
        }
コード例 #2
0
ファイル: SessionState.cs プロジェクト: Redi0/meijing-ui
		public SessionState(SessionInfo info)
		{
			this.info = info;
		}
コード例 #3
0
 public override Response processAddSession(SessionInfo info)
 {
     if(info != null)
     {
         ConnectionId connectionId = info.SessionId.ParentId;
         if(connectionId != null)
         {
             ConnectionState cs = connectionStates[connectionId];
             if(cs != null)
             {
                 cs.addSession(info);
             }
         }
     }
     return TRACKED_RESPONSE_MARKER;
 }
コード例 #4
0
 public virtual Response processAddSession(SessionInfo info)
 {
     return null;
 }
コード例 #5
0
        public override Response processAddSession(SessionInfo info)
        {
            if(info != null)
            {
                ConnectionId connectionId = info.SessionId.ParentId;
                if(connectionId != null)
                {
					ConnectionState cs = null;

					if(connectionStates.TryGetValue(connectionId, out cs))
                    {
                        cs.addSession(info);
                    }
                }
            }
            return TRACKED_RESPONSE_MARKER;
        }
コード例 #6
0
 public void addSession(SessionInfo info)
 {
     checkShutdown();
     sessions.Add(info.SessionId, new SessionState(info));
 }
コード例 #7
0
		protected void disposeOf(ITransport transport, SessionInfo session)
		{
			transport.Oneway(new RemoveInfo() { ObjectId = session.SessionId });
		}
コード例 #8
0
		protected ProducerInfo createProducer(SessionInfo parent)
		{
			return new ProducerInfo()
			{
				ProducerId = new ProducerId()
				{
					ConnectionId = parent.SessionId.ConnectionId,
					SessionId = parent.SessionId.Value,
					Value = producerIdx++
				}
			};
		}
コード例 #9
0
		protected ConsumerInfo createConsumer(SessionInfo parent)
		{
			return new ConsumerInfo()
			{
				ConsumerId = new ConsumerId()
				{
					ConnectionId = parent.SessionId.ConnectionId,
					SessionId = parent.SessionId.Value,
					Value = consumerIdx++
				}
			};
		}