示例#1
0
		public AnnouncementClient (AnnouncementEndpoint announcementEndpoint)
		{
			if (announcementEndpoint == null)
				throw new ArgumentNullException ("announcementEndpoint");
			MessageSequenceGenerator = new DiscoveryMessageSequenceGenerator ();
			client = Activator.CreateInstance (announcementEndpoint.DiscoveryVersion.AnnouncementClientType, new object [] {announcementEndpoint});
		}
示例#2
0
 public AnnouncementClient(AnnouncementEndpoint announcementEndpoint)
 {
     if (announcementEndpoint == null)
     {
         throw new ArgumentNullException("announcementEndpoint");
     }
     MessageSequenceGenerator = new DiscoveryMessageSequenceGenerator();
     client = Activator.CreateInstance(announcementEndpoint.DiscoveryVersion.AnnouncementClientType, new object [] { announcementEndpoint });
 }
示例#3
0
        MessageContractsCD1.ResolveResponse IDiscoveryProxyContractCD1.EndResolve(IAsyncResult result)
        {
            var ret = OnEndResolve(result);

            return(new MessageContractsCD1.ResolveResponse()
            {
                MessageSequence = new DiscoveryMessageSequenceCD1(DiscoveryMessageSequenceGenerator.Next()), Body = new EndpointDiscoveryMetadataCD1(ret)
            });
        }
        public DefaultDiscoveryService(
            DiscoveryServiceExtension discoveryServiceExtension,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            int duplicateMessageHistoryLength)
            : base(discoveryMessageSequenceGenerator, duplicateMessageHistoryLength)

        {
            Fx.Assert(discoveryServiceExtension != null, "The discoveryServiceExtension must be non null.");
            this.publishedEndpoints = discoveryServiceExtension.PublishedEndpoints;
        }
        public DefaultDiscoveryService(
            DiscoveryServiceExtension discoveryServiceExtension,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            int duplicateMessageHistoryLength)
            : base(discoveryMessageSequenceGenerator, duplicateMessageHistoryLength)

        {
            Fx.Assert(discoveryServiceExtension != null, "The discoveryServiceExtension must be non null.");
            this.publishedEndpoints = discoveryServiceExtension.PublishedEndpoints;
        }
            public CloseListener(Collection <AnnouncementEndpoint> announcementEndpoints, Collection <EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
            {
                Fx.Assert(announcementEndpoints != null && announcementEndpoints.Count > 0, "The Announcement Endpoints collection must be non null and not empty.");
                Fx.Assert(publishedEndpoints != null, "The Published Endpoints collection must be non null.");
                Fx.Assert(discoveryMessageSequenceGenerator != null, "The discoveryMessageSequenceGenerator must be non null.");

                this.announcementEndpoints             = announcementEndpoints;
                this.publishedEndpoints                = publishedEndpoints;
                this.discoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
                this.abortAnnouncement = false;
            }
        public AnnouncementDispatcherAsyncResult(
            Collection <AnnouncementEndpoint> endpoints,
            Collection <EndpointDiscoveryMetadata> metadatas,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            bool online,
            AsyncCallback callback,
            object state
            )
            : base(callback, state)
        {
            if (metadatas.Count == 0)
            {
                Complete(true);
                return;
            }
            bool success = false;

            this.cancelled    = false;
            this.thisLock     = new object();
            this.innerResults = new AnnouncementSendsAsyncResult[endpoints.Count];
            this.onAnnouncementSendsCompletedCallback = Fx.ThunkCallback(new AsyncCallback(OnAnnouncementSendsCompleted));
            Collection <UniqueId> messageIds = AllocateMessageIds(metadatas.Count);

            try
            {
                Random random = new Random();
                for (int i = 0; i < this.innerResults.Length; i++)
                {
                    AnnouncementClient announcementClient = new AnnouncementClient(endpoints[i]);
                    announcementClient.MessageSequenceGenerator = discoveryMessageSequenceGenerator;
                    this.innerResults[i] =
                        new AnnouncementSendsAsyncResult(
                            announcementClient,
                            metadatas,
                            messageIds,
                            online,
                            endpoints[i].MaxAnnouncementDelay,
                            random,
                            this.onAnnouncementSendsCompletedCallback,
                            this);
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    this.Cancel();
                }
            }
        }
        public AnnouncementDispatcherAsyncResult(
            Collection<AnnouncementEndpoint> endpoints,
            Collection<EndpointDiscoveryMetadata> metadatas,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            bool online,
            AsyncCallback callback,
            object state
            )
            : base(callback, state)
        {
            if (metadatas.Count == 0)
            {
                Complete(true);
                return;
            }
            bool success = false;
            this.cancelled = false;
            this.thisLock = new object();
            this.innerResults = new AnnouncementSendsAsyncResult[endpoints.Count];
            this.onAnnouncementSendsCompletedCallback = Fx.ThunkCallback(new AsyncCallback(OnAnnouncementSendsCompleted));
            Collection<UniqueId> messageIds = AllocateMessageIds(metadatas.Count);

            try
            {
                Random random = new Random();
                for (int i = 0; i < this.innerResults.Length; i++)
                {
                    AnnouncementClient announcementClient = new AnnouncementClient(endpoints[i]);
                    announcementClient.MessageSequenceGenerator = discoveryMessageSequenceGenerator;
                    this.innerResults[i] = 
                        new AnnouncementSendsAsyncResult(
                        announcementClient, 
                        metadatas, 
                        messageIds, 
                        online, 
                        endpoints[i].MaxAnnouncementDelay, 
                        random, 
                        this.onAnnouncementSendsCompletedCallback, 
                        this);
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    this.Cancel();
                }
            }
        }
        internal OnlineAnnouncementChannelDispatcher(ServiceHostBase serviceHostBase, Collection<AnnouncementEndpoint> announcementEndpoints, Collection<EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
        {
            Fx.Assert(serviceHostBase != null, "The serviceHostBase must be non null.");
            Fx.Assert(announcementEndpoints != null && announcementEndpoints.Count > 0, "The Announcement Endpoints collection must be non null and not empty.");
            Fx.Assert(publishedEndpoints != null, "The Published Endpoints collection must be non null.");
            Fx.Assert(discoveryMessageSequenceGenerator != null, "The discoveryMessageSequenceGenerator must be non null.");

            this.serviceHostBase = serviceHostBase;
            this.announcementEndpoints = announcementEndpoints;
            this.publishedEndpoints = publishedEndpoints;
            this.discoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
            this.thisLock = new object();
            InitChannelDispatchers(serviceHostBase);
        }
示例#10
0
        internal OnlineAnnouncementChannelDispatcher(ServiceHostBase serviceHostBase, Collection <AnnouncementEndpoint> announcementEndpoints, Collection <EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
        {
            Fx.Assert(serviceHostBase != null, "The serviceHostBase must be non null.");
            Fx.Assert(announcementEndpoints != null && announcementEndpoints.Count > 0, "The Announcement Endpoints collection must be non null and not empty.");
            Fx.Assert(publishedEndpoints != null, "The Published Endpoints collection must be non null.");
            Fx.Assert(discoveryMessageSequenceGenerator != null, "The discoveryMessageSequenceGenerator must be non null.");

            this.serviceHostBase                   = serviceHostBase;
            this.announcementEndpoints             = announcementEndpoints;
            this.publishedEndpoints                = publishedEndpoints;
            this.discoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
            this.thisLock = new object();
            InitChannelDispatchers(serviceHostBase);
        }
 protected DiscoveryService(
     DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
     int duplicateMessageHistoryLength)
 {
     if (discoveryMessageSequenceGenerator == null)
     {
         throw FxTrace.Exception.ArgumentNull("messageSequenceGenerator");
     }
     if (duplicateMessageHistoryLength < 0)
     {
         throw FxTrace.Exception.ArgumentOutOfRange(
             "duplicateMessageHistoryLength",
             duplicateMessageHistoryLength,
             SR.DiscoveryNegativeDuplicateMessageHistoryLength);
     }
     if (duplicateMessageHistoryLength > 0)
     {
         this.duplicateDetector = new DuplicateDetector<UniqueId>(duplicateMessageHistoryLength);
     }
     this.messageSequenceGenerator = discoveryMessageSequenceGenerator;
 }
示例#12
0
 protected DiscoveryProxy(
     DiscoveryMessageSequenceGenerator messageSequenceGenerator,
     int duplicateMessageHistoryLength)
 {
     if (messageSequenceGenerator == null)
     {
         throw FxTrace.Exception.ArgumentNull("messageSequenceGenerator");
     }
     if (duplicateMessageHistoryLength < 0)
     {
         throw FxTrace.Exception.ArgumentOutOfRange(
                   "duplicateMessageHistoryLength",
                   duplicateMessageHistoryLength,
                   SR.DiscoveryNegativeDuplicateMessageHistoryLength);
     }
     if (duplicateMessageHistoryLength > 0)
     {
         this.duplicateDetector = new DuplicateDetector <UniqueId>(duplicateMessageHistoryLength);
     }
     this.messageSequenceGenerator = messageSequenceGenerator;
 }
示例#13
0
		protected DiscoveryProxy (DiscoveryMessageSequenceGenerator messageSequenceGenerator, int duplicateMessageHistoryLength)
		{
		}
示例#14
0
		protected DiscoveryProxy (DiscoveryMessageSequenceGenerator messageSequenceGenerator)
			: this (messageSequenceGenerator, 0)
		{
		}
示例#15
0
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator, int duplicateMessageHistoryLength)
 {
     DiscoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
     DuplicateMessageHistoryLength     = duplicateMessageHistoryLength;
 }
示例#16
0
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator)
     : this(messageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
        internal OfflineAnnouncementChannelDispatcher(ServiceHostBase serviceHostBase, Collection <AnnouncementEndpoint> announcementEndpoints, Collection <EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
        {
            Fx.Assert(serviceHostBase != null, "The serviceHostBase must be non null.");

            this.serviceHostBase = serviceHostBase;
            this.closeListener   = new CloseListener(announcementEndpoints, publishedEndpoints, discoveryMessageSequenceGenerator);
        }
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator)
     : this(messageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
        IAsyncResult IDiscoveryTargetContractCD1.BeginOnlineAnnouncement(MessageContractsCD1.OnlineAnnouncement msg, AsyncCallback callback, object state)
        {
            var edm = msg.EndpointDiscoveryMetadata != null?msg.EndpointDiscoveryMetadata.ToEndpointDiscoveryMetadata() : null;

            return(OnBeginOnlineAnnouncement(DiscoveryMessageSequenceGenerator.Next(), edm, callback, state));
        }
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator, int duplicateMessageHistoryLength)
 {
 }
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
     : this(discoveryMessageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
示例#22
0
		protected DiscoveryService (DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
		{
		}
示例#23
0
		protected DiscoveryService (DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator, int duplicateMessageHistoryLength)
		{
		}
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator)
     : this(messageSequenceGenerator, 0)
 {
 }
示例#25
0
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
     : this(discoveryMessageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
示例#26
0
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
     : this(discoveryMessageSequenceGenerator, 0)
 {
 }