コード例 #1
0
 public static IMQueueRawClient GetQueueRawClient(this CoreServices services, string queuePairName, bool sendOnly = false)
 {
     Init();
     if (_queues?.Items?.Contains(queuePairName) == true)
     {
         return(_queues.Items[queuePairName].GetRawClient(sendOnly));
     }
     throw new NullReferenceException($"The Queue Pair Name: {queuePairName} not found in the configuration file.");
 }
コード例 #2
0
 public static IMQueueRawServer GetQueueRawServer(this CoreServices services, bool responseServer = false)
 {
     Init();
     if (_queueServer is null)
     {
         var queueSettings = Core.GetSettings <QueueConfigurationSettings>();
         throw new KeyNotFoundException($"The Queue server name: {queueSettings.ServerName} couldn't be found or loaded in the queue configuration file.");
     }
     return(_queueServer.GetRawServer(responseServer));
 }
コード例 #3
0
        public static ServerOptions GetCacheServerOptions(this CoreServices services, string name)
        {
            Init();
            var cConfig = _serverCacheSettings.Caches?.FirstOrDefault((c, mName) => c.Name == mName, name);

            return(cConfig?.ServerOptionsList?.FirstOf(
                       c => c.EnvironmentName?.SplitAndTrim(",").Contains(Core.EnvironmentName) == true && c.MachineName?.SplitAndTrim(",").Contains(Core.MachineName) == true,
                       c => c.EnvironmentName?.SplitAndTrim(",").Contains(Core.EnvironmentName) == true,
                       c => c.MachineName?.SplitAndTrim(",").Contains(Core.MachineName) == true,
                       c => c.EnvironmentName.IsNullOrWhitespace()));
        }
コード例 #4
0
        public static IMQueueRawServer GetQueueRawServer(this CoreServices services, string queuePairName, bool responseServer = false)
        {
            Init();
            if (_queues.Items?.Contains(queuePairName) != true)
            {
                throw new KeyNotFoundException(
                          $"The Queue server name: {queuePairName} couldn't be found in the queue configuration file.");
            }

            var serverPair = _queues.Items[queuePairName];

            return(serverPair.GetRawServer(responseServer));
        }
コード例 #5
0
 public static MQueuesConfiguration GetDefaultQueuesConfiguration(this CoreServices services)
 {
     Init();
     return(_queues);
 }
コード例 #6
0
 public static void SetDefaultCacheClientSettings(this CoreServices services, CacheSettings settings)
 {
     _init     = true;
     _settings = settings;
 }
コード例 #7
0
 public static async Task <CacheClientPoolAsync> GetCacheClientAsync(this CoreServices services, string name)
 {
     Init();
     Ensure.ReferenceNotNull(_settings, "The client configuration settings is null, check if the cache configuration file is setted or is previously setted with the SetDefaultCacheClientSettings method.");
     return(await _settings.GetCacheClientAsync(name).ConfigureAwait(false));
 }
コード例 #8
0
 public static void SetDefaultCacheServerOptions(this CoreServices services, ServerOptions options)
 {
     _init = true;
     _defaultServerOptions = options;
 }
コード例 #9
0
 public static ServerOptions GetDefaultCacheServerOptions(this CoreServices services)
 {
     Init();
     return(_defaultServerOptions);
 }
コード例 #10
0
 public static CacheConfiguration GetCacheServerConfiguration(this CoreServices services, string name)
 {
     Init();
     return(_serverCacheSettings.Caches?.FirstOrDefault((c, mName) => c.Name == mName, name));
 }
コード例 #11
0
 public static void SetDefaultCacheServerConfiguration(this CoreServices services, CacheConfiguration configuration)
 {
     _init = true;
     _defaultCacheConfiguration = configuration;
 }
コード例 #12
0
 public static CacheConfiguration GetDefaultCacheServerConfiguration(this CoreServices services)
 {
     Init();
     return(_defaultCacheConfiguration);
 }
コード例 #13
0
 public static void SetDefaultCacheClientSettings(this CoreServices services, CacheSettings settings)
 {
     _init     = Interlocked.Exchange(ref _init, 1);
     _settings = settings;
 }