Example #1
0
 public CacheRequestManager(
     Hummingbird.Extersions.Idempotency.IIdempotencyOption option,
     IHummingbirdCache <object> cacheManager)
 {
     _option       = option ?? throw new ArgumentNullException(nameof(option));
     _cacheManager = cacheManager ?? throw new ArgumentNullException(nameof(cacheManager));
 }
Example #2
0
 public EventBusRabbitMQ(
     IHummingbirdCache <bool> cacheManager,
     IRabbitMQPersistentConnection persistentConnection,
     ILogger <EventBusRabbitMQ> logger,
     IServiceProvider lifetimeScope,
     int retryCount          = 3,
     ushort preFetch         = 1,
     int IdempotencyDuration = 15,
     string exchange         = "amp.topic",
     string exchangeType     = "topic")
 {
     this._lifetimeScope        = lifetimeScope ?? throw new ArgumentNullException(nameof(lifetimeScope));
     this._IdempotencyDuration  = IdempotencyDuration;
     this._cacheManager         = cacheManager ?? throw new ArgumentNullException(nameof(cacheManager));
     this._persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));;
     this._logger              = logger ?? throw new ArgumentNullException(nameof(logger));
     this._retryCount          = retryCount;
     this._preFetch            = preFetch;
     this._exchange            = exchange;
     this._exchangeType        = exchangeType;
     this._eventBusRetryPolicy = RetryPolicy.Handle <BrokerUnreachableException>()
                                 .Or <SocketException>()
                                 .Or <System.IO.IOException>()
                                 .Or <AlreadyClosedException>()
                                 .WaitAndRetry(_retryCount, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (ex, time) =>
     {
         _logger.LogWarning(ex.ToString());
     });
 }
        public ValuesController(IEventBus eventBus, IHttpClient httpClient, IHummingbirdCache <string> cache)
        {
            _eventBus   = eventBus;
            _httpClient = httpClient;
            _cache      = cache;

            _cache.Add("11", "test", TimeSpan.FromMinutes(5), "ProjectName:Enviroment1:Regsion1");
            _cache.Add("22", "test", TimeSpan.FromMinutes(5), "ProjectName:Enviroment2:Regsion1");
            _cache.Add("33", "test", TimeSpan.FromMinutes(5), "ProjectName:Enviroment1:Regsion2");
            _cache.Add("44", "test", TimeSpan.FromMinutes(5), "ProjectName:Enviroment2:Regsion2");
        }
Example #4
0
 public EventBusRabbitMQ(
     IHummingbirdCache <bool> cacheManager,
     IRabbitMQPersistentConnection persistentConnection,
     ILogger <EventBusRabbitMQ> logger,
     IServiceProvider lifetimeScope,
     int retryCount          = 3,
     ushort preFetch         = 1,
     int IdempotencyDuration = 15,
     string exchange         = "amp.topic",
     string exchangeType     = "topic")
 {
     this._lifetimeScope        = lifetimeScope ?? throw new ArgumentNullException(nameof(lifetimeScope));
     this._IdempotencyDuration  = IdempotencyDuration;
     this._cacheManager         = cacheManager ?? throw new ArgumentNullException(nameof(cacheManager));
     this._persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));;
     this._logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     this._retryCount   = retryCount;
     this._preFetch     = preFetch;
     this._exchange     = exchange;
     this._exchangeType = exchangeType;
 }
Example #5
0
 public ValuesController(IEventBus eventBus, IHttpClient httpClient, IHummingbirdCache <string> cache)
 {
     _eventBus   = eventBus;
     _httpClient = httpClient;
     _cache      = cache;
 }