示例#1
0
        public HttpJsonRequest AddReplicationStatusHeaders(string thePrimaryUrl, string currentUrl, ReplicationInformer replicationInformer, FailoverBehavior failoverBehavior, Action <NameValueCollection, string, string> handleReplicationStatusChanges)
        {
            if (thePrimaryUrl.Equals(currentUrl, StringComparison.InvariantCultureIgnoreCase))
            {
                return(this);
            }
            if (replicationInformer.GetFailureCount(thePrimaryUrl) <= 0)
            {
                return(this);                // not because of failover, no need to do this.
            }
            var lastPrimaryCheck = replicationInformer.GetFailureLastCheck(thePrimaryUrl);

            webRequest.Headers[Constants.RavenClientPrimaryServerUrl]       = ToRemoteUrl(thePrimaryUrl);
            webRequest.Headers[Constants.RavenClientPrimaryServerLastCheck] = lastPrimaryCheck.ToString("s");

            primaryUrl   = thePrimaryUrl;
            operationUrl = currentUrl;

            HandleReplicationStatusChanges = handleReplicationStatusChanges;

            return(this);
        }
示例#2
0
        public HttpJsonRequest AddReplicationStatusHeaders(string thePrimaryUrl, string currentUrl, ReplicationInformer replicationInformer, FailoverBehavior failoverBehavior, Action <string, string, string> handleReplicationStatusChanges)
        {
            if (thePrimaryUrl.Equals(currentUrl, StringComparison.OrdinalIgnoreCase))
            {
                return(this);
            }
            if (replicationInformer.GetFailureCount(thePrimaryUrl) <= 0)
            {
                return(this);                // not because of failover, no need to do this.
            }
            var lastPrimaryCheck = replicationInformer.GetFailureLastCheck(thePrimaryUrl);

            httpClient.DefaultRequestHeaders.Add(Constants.RavenClientPrimaryServerUrl, ToRemoteUrl(thePrimaryUrl));
            httpClient.DefaultRequestHeaders.Add(Constants.RavenClientPrimaryServerLastCheck, lastPrimaryCheck.ToString("s"));

            primaryUrl   = thePrimaryUrl;
            operationUrl = currentUrl;

            HandleReplicationStatusChanges = handleReplicationStatusChanges;

            return(this);
        }
示例#3
0
		public HttpJsonRequest AddReplicationStatusHeaders(string thePrimaryUrl, string currentUrl, ReplicationInformer replicationInformer, FailoverBehavior failoverBehavior, Action<NameValueCollection, string, string> handleReplicationStatusChanges)
		{
			if (thePrimaryUrl.Equals(currentUrl, StringComparison.InvariantCultureIgnoreCase))
				return this;
			if (replicationInformer.GetFailureCount(thePrimaryUrl) <= 0)
				return this; // not because of failover, no need to do this.

			var lastPrimaryCheck = replicationInformer.GetFailureLastCheck(thePrimaryUrl);
			webRequest.Headers.Add(Constants.RavenClientPrimaryServerUrl, ToRemoteUrl(thePrimaryUrl));
			webRequest.Headers.Add(Constants.RavenClientPrimaryServerLastCheck, lastPrimaryCheck.ToString("s"));

			primaryUrl = thePrimaryUrl;
			operationUrl = currentUrl;

			HandleReplicationStatusChanges = handleReplicationStatusChanges;

			return this;
		}