Beispiel #1
0
        public GCPStorageManager(IAppLogger appLogger, GCPSettings gcpSettings)
        {
            _gcpSettings = gcpSettings;
            _appLogger   = appLogger;

            _localRetryPolicy = Policy
                                .Handle <Exception>()
                                .WaitAndRetryAsync(3,
                                                   retryAttempt => TimeSpan.FromMilliseconds(200),
                                                   (exception, timeSpan, retryCount, context) =>
            {
                var msg = $"GCPStorageManager Retry - Count:{retryCount}, Exception:{exception.Message}";
                _appLogger.LogWarning(msg);
            });
        }
        public GCPQueuePublisher(IAppLogger appLogger, GCPSettings gcpSettings)
        {
            _appLogger   = appLogger;
            _gcpSettings = gcpSettings;

            _retryPolicy = Policy
                           .Handle <Exception>()
                           .WaitAndRetryAsync(3,
                                              retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
                                              (exception, timeSpan, retryCount, context) =>
            {
                var msg = $"GCPQueuePublisher Retry - Count:{retryCount}, Exception:{exception.Message}";
                _appLogger?.LogWarning(msg);
            }
                                              );
        }
Beispiel #3
0
        static void InitConfiguration()
        {
            _consoleLogger.LogMessage("Start Init Config");

            // Used to build key/value based configuration settings for use in an application
            // Note: AddJsonFile is an extension methods for adding JsonConfigurationProvider.
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appSettings.json");

            // Builds an IConfiguration with keys and values from the set of sources
            var configuration = builder.Build();

            // Bind the respective section to the respective settings class
            _awsSettings   = configuration.GetSection("aws").Get <AWSSettings>();
            _azureSettings = configuration.GetSection("azure").Get <AzureSettings>();
            _gcpSettings   = configuration.GetSection("gcp").Get <GCPSettings>();

            _consoleLogger.LogMessage("End Init Config");
        }
        public GCPGameStateStore(IAppLogger appLogger, GCPSettings gcpSettings)
        {
            _gcpSettings = gcpSettings;
            _appLogger   = appLogger;

            _retryPolicy = Policy
                           .Handle <Exception>()
                           .WaitAndRetryAsync(3,
                                              retryAttempt => TimeSpan.FromMilliseconds(200),
                                              (exception, timeSpan, retryCount, context) =>
            {
                var msg = $"GCPGameStateStore - Count:{retryCount}, Exception:{exception.Message}";
                _appLogger.LogWarning(msg);
            });

            var datastoreClient = InitDatastoreClient();

            _db = DatastoreDb.Create(_gcpSettings.NoSQL.ProjectId, client: datastoreClient);

            _keyFactory = _db.CreateKeyFactory(_tableName);
        }
Beispiel #5
0
 public GCPQueuePublisher(IAppLogger appLogger, GCPSettings gcpSettings)
 {
     _appLogger   = appLogger;
     _gcpSettings = gcpSettings;
 }
 public GCPQueueSubscriber(IAppLogger appLogger, GCPSettings gcpSettings)
 {
     _appLogger   = appLogger;
     _gcpSettings = gcpSettings;
 }
Beispiel #7
0
 public GCPGameStateStore(IAppLogger appLogger, GCPSettings gcpSettings)
 {
     _gcpSettings = gcpSettings;
     _appLogger   = appLogger;
 }
 public GCPStorageManager(IAppLogger appLogger, GCPSettings gcpSettings)
 {
     _appLogger   = appLogger;
     _gcpSettings = gcpSettings;
 }