Esempio n. 1
0
        public IPullSubscriptionClient <T> SubscribeUsingPullDelivery <T>(Uri subscriptionResourceUri, Uri pullResourceUri, Filter filter, IEnumerable <Selector> selectors)
        {
            SubscribeResponse response;

            using (ClientContext <IWSEventingContract> ctx =
                       new ClientContext <IWSEventingContract>(_endpointUri, _binding.MessageVersion.Addressing, _proxyFactory, mx => {
                mx.Add(new SelectorSetHeader(selectors));
                mx.Add(new ResourceUriHeader(subscriptionResourceUri.ToString()));
            }))
            {
                FilterMapExtension.Activate(_filterMap);
                response = ctx.Channel.Subscribe(new SubscribeRequest
                {
                    Delivery = Delivery.Pull(),
                    Filter   = filter,
                    Expires  = Expires.FromDateTime(DateTime.Now.AddYears(1))
                });
            }
            return(new PullSubscriptionClientImpl <T>(_endpointUri, _binding, _filterMap, response.EnumerationContext, pullResourceUri.ToString(), _proxyFactory));
        }