Пример #1
0
 public SessionPumpHost(string clientId, ReceiveMode receiveMode, IMessageSessionEntity sessionClient)
 {
     this.syncLock      = new object();
     this.ClientId      = clientId;
     this.ReceiveMode   = receiveMode;
     this.SessionClient = sessionClient;
 }
        public SessionReceivePump(
            string clientId,
            IMessageSessionEntity client,
            ReceiveMode receiveMode,
            SessionHandlerOptions sessionHandlerOptions,
            Func <IMessageSession, Message, CancellationToken, Task> callback,
            CancellationToken token)
        {
            if (client == null)
            {
                throw new ArgumentException(nameof(client));
            }

            this.client                = client;
            this.clientId              = clientId;
            this.ReceiveMode           = receiveMode;
            this.sessionHandlerOptions = sessionHandlerOptions;
            this.userOnSessionCallback = callback;
            this.pumpCancellationToken = token;
            this.maxConcurrentSessionsSemaphoreSlim    = new SemaphoreSlim(this.sessionHandlerOptions.MaxConcurrentSessions);
            this.maxPendingAcceptSessionsSemaphoreSlim = new SemaphoreSlim(this.sessionHandlerOptions.MaxConcurrentAcceptSessionCalls);
        }
 public MessageSessionPumpHost(object syncRoot, string entityName, IMessageSessionEntity entity)
 {
     this.syncRoot   = syncRoot;
     this.entityName = entityName;
     this.entity     = entity;
 }