public ValueTranslatorHttpSender(IHttpSender httpSender, string translationClientName)
        {
            InternalContract.RequireNotNull(httpSender, nameof(httpSender));
            InternalContract.RequireNotNullOrWhiteSpace(translationClientName, nameof(translationClientName));
            HttpSender = httpSender;

            TranslationClientName = translationClientName;
        }
示例#2
0
 public JobDetailSender(NodeConfiguration nodeConfiguration,
                        IHttpSender httpSender)
 {
     _httpSender       = httpSender;
     _jobDetails       = new List <JobDetailEntity>();
     _uriBuilder       = new UriBuilder(nodeConfiguration.ManagerLocation);
     _uriBuilder.Path += ManagerRouteConstants.JobProgress;
 }
		public TrySendJobDetailToManagerTimerFake(NodeConfiguration nodeConfiguration, 
													IHttpSender httpSender,
		                                            double interval) : base(nodeConfiguration, 
																			httpSender, 
																			interval)
		{
			WaitHandle = new ManualResetEventSlim();
		}
 public NodeStartupNotificationToManagerFake(NodeConfiguration nodeConfiguration,
                                             IHttpSender httpSender,
                                             double interval = 1000,
                                             bool autoReset  = false) : base(nodeConfiguration,
                                                                             httpSender,
                                                                             interval,
                                                                             autoReset)
 {
 }
示例#5
0
		public SendJobDoneTimerFake(NodeConfiguration nodeConfiguration,
									TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer,
									IHttpSender httpSender,
									double interval = 1000) : base(nodeConfiguration,
																   sendJobDetailToManagerTimer,
																   httpSender,
																   interval)
		{
		}
示例#6
0
 public HttpClient(HttpClientBuilder builder)
 {
     _host                 = builder.Host;
     _keepAlive            = builder.KeepAlive;
     _sender               = builder.Sender ?? new HttpSenderAsync(_host, builder.Decoders);
     Timeout               = builder.Timeout;
     _requestPreprocessor  = builder.RequestMiddleware;
     _responsePreprocessor = builder.ResponseMiddleware;
 }
示例#7
0
 public SendJobDoneTimerFake(NodeConfiguration nodeConfiguration,
                             JobDetailSender jobDetailSender,
                             IHttpSender httpSender,
                             double interval = 1000) : base(nodeConfiguration,
                                                            jobDetailSender,
                                                            httpSender,
                                                            interval)
 {
 }
		public NodeStartupNotificationToManagerFake(NodeConfiguration nodeConfiguration,
													IHttpSender httpSender,
		                                            double interval = 1000,
		                                            bool autoReset = false) : base(nodeConfiguration,
																				   httpSender,
																				   interval,
		                                                                           autoReset)
		{
		}
 public SendJobDoneWithEventTriggerTimerFake(NodeConfiguration nodeConfiguration,
                                             Uri callbackTemplateUri,
                                             JobDetailSender jobDetailSender,
                                             IHttpSender httpSender) : base(nodeConfiguration,
                                                                            callbackTemplateUri,
                                                                            jobDetailSender,
                                                                            httpSender)
 {
 }
		public SendJobDoneWithEventTriggerTimerFake(NodeConfiguration nodeConfiguration,
		                                            Uri callbackTemplateUri,
		                                            TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer,
		                                            IHttpSender httpSender) : base(nodeConfiguration,
		                                                                           callbackTemplateUri,
		                                                                           sendJobDetailToManagerTimer,
		                                                                           httpSender)
		{
		}
 public TrySendJobCanceledToManagerTimer(NodeConfiguration nodeConfiguration,
                                         JobDetailSender jobDetailSender,
                                         IHttpSender httpSender,
                                         double interval = 500) : base(nodeConfiguration,
                                                                       nodeConfiguration.GetManagerJobHasBeenCanceledTemplateUri(),
                                                                       jobDetailSender,
                                                                       httpSender,
                                                                       interval)
 {
 }
示例#12
0
 public TrySendJobDoneStatusToManagerTimer(NodeConfiguration nodeConfiguration,
                                           JobDetailSender jobDetailSender,
                                           IHttpSender httpSender,
                                           double interval = 500) : base(nodeConfiguration,
                                                                         nodeConfiguration.GetManagerJobDoneTemplateUri(),
                                                                         jobDetailSender,
                                                                         httpSender,
                                                                         interval)
 {
 }
		public TrySendJobDoneStatusToManagerTimer(NodeConfiguration nodeConfiguration,
												  TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer,
												  IHttpSender httpSender,
												  double interval = 500) : base(nodeConfiguration,
		                                                                          nodeConfiguration.GetManagerJobDoneTemplateUri(),
																				  sendJobDetailToManagerTimer,
																				  httpSender,
																				  interval)
		{
		}
		public TrySendJobCanceledToManagerTimer(NodeConfiguration nodeConfiguration,
												TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer,
												IHttpSender httpSender,
												double interval = 500) : base(nodeConfiguration,
		                                                                        nodeConfiguration.GetManagerJobHasBeenCanceledTemplateUri(),
																				sendJobDetailToManagerTimer,
																				httpSender,
																				interval)
		{
		}
示例#15
0
		public PingToManagerTimer(NodeConfiguration nodeConfiguration,
		                          IHttpSender httpSender) : base(nodeConfiguration.PingToManagerSeconds*1000)
		{
			_cancellationTokenSource = new CancellationTokenSource();

			_nodeConfiguration = nodeConfiguration;
			_httpSender = httpSender;
			_whoAmI = nodeConfiguration.CreateWhoIAm(Environment.MachineName);

			Elapsed += OnTimedEvent;
		}
示例#16
0
        public PingToManagerTimer(NodeConfiguration nodeConfiguration,
                                  IHttpSender httpSender) : base(nodeConfiguration.PingToManagerSeconds * 1000)
        {
            _cancellationTokenSource = new CancellationTokenSource();
            _exceptionLoggerHandler  = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());
            _nodeConfiguration       = nodeConfiguration;
            _httpSender = httpSender;
            _whoAmI     = nodeConfiguration.CreateWhoIAm(Environment.MachineName);

            Elapsed += OnTimedEvent;
        }
		public TrySendJobFaultedToManagerTimer(NodeConfiguration nodeConfiguration,
		                                       TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer,
		                                       IHttpSender httpSender,
		                                       double interval = 500) : base(nodeConfiguration,
		                                                                     nodeConfiguration
			                                                                     .GetManagerJobHasFailedTemplatedUri(),
		                                                                     sendJobDetailToManagerTimer,
		                                                                     httpSender,
		                                                                     interval)
		{
			_httpSender = httpSender;
		}
		public TrySendJobDetailToManagerTimer(NodeConfiguration nodeConfiguration,
		                                        IHttpSender httpSender,
		                                        double interval = 500) : base(interval)
		{
			_httpSender = httpSender;
			_cancellationTokenSource = new CancellationTokenSource();
			_jobDetails = new ConcurrentDictionary<Guid, JobDetailEntity>();
			_uriBuilder = new UriBuilder(nodeConfiguration.ManagerLocation);
			_uriBuilder.Path += ManagerRouteConstants.JobProgress;

			Elapsed += OnTimedEvent;
		}
 public TrySendJobFaultedToManagerTimer(NodeConfiguration nodeConfiguration,
                                        JobDetailSender jobDetailSender,
                                        IHttpSender httpSender,
                                        double interval = 500) : base(nodeConfiguration,
                                                                      nodeConfiguration
                                                                      .GetManagerJobHasFailedTemplatedUri(),
                                                                      jobDetailSender,
                                                                      httpSender,
                                                                      interval)
 {
     _httpSender = httpSender;
 }
		public TrySendStatusToManagerTimer(NodeConfiguration nodeConfiguration,
		                                   Uri callbackTemplateUri,
		                                   TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer,
		                                   IHttpSender httpSender, double interval = 500) : base(interval)
		{
			_cancellationTokenSource = new CancellationTokenSource();
			_whoAmI = nodeConfiguration.CreateWhoIAm(Environment.MachineName);
			_sendJobDetailToManagerTimer = sendJobDetailToManagerTimer;
			_httpSender = httpSender;
			CallbackTemplateUri = callbackTemplateUri;

			Elapsed += OnTimedEvent;
			AutoReset = true;
		}
		public TrySendNodeStartUpNotificationToManagerTimer(NodeConfiguration nodeConfiguration,
		                                                    IHttpSender httpSender,
		                                                    double interval = 5000,
		                                                    bool autoReset = true) : base(interval)
		{
			var callbackToManagerTemplateUri = nodeConfiguration.GetManagerNodeHasBeenInitializedUri();
			_cancellationTokenSource = new CancellationTokenSource();
			_nodeConfiguration = nodeConfiguration;
			_callbackToManagerTemplateUri = callbackToManagerTemplateUri;
			_httpSender = httpSender;
			_whoAmI = _nodeConfiguration.CreateWhoIAm(Environment.MachineName);

			Elapsed += OnTimedEvent;
			AutoReset = autoReset;
		}
        public TrySendStatusToManagerTimer(NodeConfiguration nodeConfiguration,
                                           Uri callbackTemplateUri,
                                           JobDetailSender jobDetailSender,
                                           IHttpSender httpSender, double interval = 500) : base(interval)
        {
            _cancellationTokenSource = new CancellationTokenSource();
            _whoAmI                 = nodeConfiguration.CreateWhoIAm(Environment.MachineName);
            _enableGc               = nodeConfiguration.EnableGarbageCollection;
            _jobDetailSender        = jobDetailSender;
            _httpSender             = httpSender;
            CallbackTemplateUri     = callbackTemplateUri;
            _exceptionLoggerHandler = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());

            Elapsed  += OnTimedEvent;
            AutoReset = true;
        }
        public TrySendNodeStartUpNotificationToManagerTimer(NodeConfiguration nodeConfiguration,
                                                            IHttpSender httpSender,
                                                            double interval = 5000,
                                                            bool autoReset  = true) : base(interval)
        {
            var callbackToManagerTemplateUri = nodeConfiguration.GetManagerNodeHasBeenInitializedUri();

            _cancellationTokenSource      = new CancellationTokenSource();
            _nodeConfiguration            = nodeConfiguration;
            _callbackToManagerTemplateUri = callbackToManagerTemplateUri;
            _httpSender             = httpSender;
            _whoAmI                 = _nodeConfiguration.CreateWhoIAm(Environment.MachineName);
            _exceptionLoggerHandler = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());

            Elapsed  += OnTimedEvent;
            AutoReset = autoReset;
        }
示例#24
0
		public JobRepository(ManagerConfiguration managerConfiguration,
		                     RetryPolicyProvider retryPolicyProvider,
							 CreateSqlCommandHelper createSqlCommandHelper, 
							 IHttpSender httpSender)
		{
			if (retryPolicyProvider == null)
			{
				throw new ArgumentNullException("retryPolicyProvider");
			}

			if (retryPolicyProvider.GetPolicy() == null)
			{
				throw new ArgumentNullException("retryPolicyProvider.GetPolicy");
			}

			_connectionString = managerConfiguration.ConnectionString;
			_createSqlCommandHelper = createSqlCommandHelper;
			_httpSender = httpSender;

			_retryPolicy = retryPolicyProvider.GetPolicy();
		}
示例#25
0
        //private static readonly ILog ManagerLogger = LogManager.GetLogger("Stardust.ManagerLog");

        public JobRepository(ManagerConfiguration managerConfiguration,
                             RetryPolicyProvider retryPolicyProvider,
                             IHttpSender httpSender,
                             JobRepositoryCommandExecuter jobRepositoryCommandExecuter,
                             ILog managerLogger)
        {
            if (retryPolicyProvider == null)
            {
                throw new ArgumentNullException("retryPolicyProvider");
            }

            if (retryPolicyProvider.GetPolicy() == null)
            {
                throw new ArgumentNullException("retryPolicyProvider.GetPolicy");
            }

            _connectionString             = managerConfiguration.ConnectionString;
            _httpSender                   = httpSender;
            _jobRepositoryCommandExecuter = jobRepositoryCommandExecuter;
            ManagerLogger                 = managerLogger;

            _retryPolicy = retryPolicyProvider.GetPolicy();
        }
 public Capability1RestClient(IHttpSender httpSender) : base(httpSender)
 {
 }
示例#27
0
 public BusinessApiRestClient(IHttpSender httpSender) : base(httpSender)
 {
 }
 /// <summary></summary>
 /// <param name="parentName">The name of the sub path that is the parent of the children. (Singular noun)</param>
 /// <param name="childrenName">The name of the sub path that are the children. (Plural noun)</param>
 /// <param name="httpSender">How to actually send HTTP requests.</param>
 public CrudSlaveToMasterRestClient(string parentName, string childrenName, IHttpSender httpSender)
     : base(parentName, childrenName, httpSender)
 {
 }
示例#29
0
 public WeiXinService(IHttpSender httpSender, IOptions <WechatAccountOptions> options)
 {
     _httpSender = httpSender;
     _options    = options;
 }
示例#30
0
 public HttpClientBuilder WithCustomSender(IHttpSender sender)
 {
     Sender = sender;
     return(this);
 }
示例#31
0
 /// <summary></summary>
 /// <param name="parentName">The name of the sub path that is the parent of the children. (Singular noun)</param>
 /// <param name="childrenName">The name of the sub path that are the children. (Plural noun)</param>
 /// <param name="httpSender">How to actually send HTTP requests.</param>
 public CrudDependentToMasterWithUniqueIdRestClient(string parentName, string childrenName, IHttpSender httpSender)
     : base(parentName, childrenName, httpSender)
 {
 }
示例#32
0
 /// <inheritdoc />
 public RestClient(IHttpSender httpSender)
 {
     InternalContract.RequireNotNull(httpSender, nameof(httpSender));
     HttpSender = httpSender;
 }
示例#33
0
 public IntegrationApiRestClient(IHttpSender httpSender) : base(httpSender)
 {
 }
 /// <summary></summary>
 /// <param name="parentName">The name of the sub path that is the parent of the children. (Singular noun)</param>
 /// <param name="childrenName">The name of the sub path that are the children. (Plural noun)</param>
 /// <param name="httpSender">How to actually send HTTP requests.</param>
 public CrudManyToOneRestClient(IHttpSender httpSender, string parentName = "Parent", string childrenName = "Children")
     : base(httpSender, parentName, childrenName)
 {
 }
示例#35
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="httpSender"></param>
 public CrudRestClient(IHttpSender httpSender)
     : base(httpSender)
 {
 }
示例#36
0
 public HttpClient(string host, bool keepAlive = true)
 {
     _host      = host;
     _keepAlive = keepAlive;
     _sender    = new HttpSenderAsync(host, new IContentEncoder[0]);
 }