Пример #1
0
      public SubscribeResponse Subscribe(string resourceUri, IEnumerable<Selector> selectors, SubscribeRequest request)
      {
         EndpointAddressBuilder susbcriptionManagerEndpointAddress = new EndpointAddressBuilder();

         Expires expiration = request.Expires ?? Expires.FromTimeSpan(DefaultExpirationTime);

         Subsciption subsciption = GetManager(resourceUri, request.Filter).Subscribe(
            request.Filter,
            selectors,
            expiration,
            susbcriptionManagerEndpointAddress);
         
         lock (_activeSubscriptions)
         {            
            _activeSubscriptions[subsciption.Identifier] = subsciption;            
         }
         //R7.2.4-1
         return new SubscribeResponse
                   {                      
                      SubscriptionManager = new SubscriptionManager(susbcriptionManagerEndpointAddress, subsciption.Identifier, OperationContextProxy.Current.LocalAddress, subsciption.DeliveryResourceUri),                      
                      EnumerationContext = request.Delivery.Mode == Delivery.DeliveryModePull 
                         ? new EnumerationContextKey(subsciption.Identifier) 
                         : null,
                      Expires = expiration
                   };
      }
Пример #2
0
      public SubscribeResponse Subscribe(SubscribeRequest request)
      {
         //Check
         SelectorSetHeader selectorSetHeader = OperationContextProxy.Current.FindHeader<SelectorSetHeader>();         
         //Check
         ResourceUriHeader resourceUriHeader = OperationContextProxy.Current.FindHeader<ResourceUriHeader>();            

         return Subscribe(resourceUriHeader.ResourceUri, selectorSetHeader != null ? selectorSetHeader.Selectors : (IEnumerable<Selector>)new Selector[] { }, request);
      }
Пример #3
0
        public SubscribeResponse Subscribe(SubscribeRequest request)
        {
            //Check
            SelectorSetHeader selectorSetHeader = OperationContextProxy.Current.FindHeader <SelectorSetHeader>();
            //Check
            ResourceUriHeader resourceUriHeader = OperationContextProxy.Current.FindHeader <ResourceUriHeader>();

            return(Subscribe(resourceUriHeader.ResourceUri, selectorSetHeader != null ? selectorSetHeader.Selectors : (IEnumerable <Selector>) new Selector[] { }, request));
        }
Пример #4
0
        public SubscribeResponse Subscribe(string resourceUri, IEnumerable <Selector> selectors, SubscribeRequest request)
        {
            EndpointAddressBuilder susbcriptionManagerEndpointAddress = new EndpointAddressBuilder();

            Expires expiration = request.Expires ?? Expires.FromTimeSpan(DefaultExpirationTime);

            Subsciption subsciption = GetManager(resourceUri, request.Filter).Subscribe(
                request.Filter,
                selectors,
                expiration,
                susbcriptionManagerEndpointAddress);

            lock (_activeSubscriptions)
            {
                _activeSubscriptions[subsciption.Identifier] = subsciption;
            }
            //R7.2.4-1
            return(new SubscribeResponse
            {
                SubscriptionManager = new SubscriptionManager(susbcriptionManagerEndpointAddress, subsciption.Identifier, OperationContextProxy.Current.LocalAddress, subsciption.DeliveryResourceUri),
                EnumerationContext = request.Delivery.Mode == Delivery.DeliveryModePull
                         ? new EnumerationContextKey(subsciption.Identifier)
                         : null,
                Expires = expiration
            });
        }