Ejemplo n.º 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.");
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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()));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 5
0
 public static MQueuesConfiguration GetDefaultQueuesConfiguration(this CoreServices services)
 {
     Init();
     return(_queues);
 }
Ejemplo n.º 6
0
 public static void SetDefaultCacheClientSettings(this CoreServices services, CacheSettings settings)
 {
     _init     = true;
     _settings = settings;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 8
0
 public static void SetDefaultCacheServerOptions(this CoreServices services, ServerOptions options)
 {
     _init = true;
     _defaultServerOptions = options;
 }
Ejemplo n.º 9
0
 public static ServerOptions GetDefaultCacheServerOptions(this CoreServices services)
 {
     Init();
     return(_defaultServerOptions);
 }
Ejemplo n.º 10
0
 public static CacheConfiguration GetCacheServerConfiguration(this CoreServices services, string name)
 {
     Init();
     return(_serverCacheSettings.Caches?.FirstOrDefault((c, mName) => c.Name == mName, name));
 }
Ejemplo n.º 11
0
 public static void SetDefaultCacheServerConfiguration(this CoreServices services, CacheConfiguration configuration)
 {
     _init = true;
     _defaultCacheConfiguration = configuration;
 }
Ejemplo n.º 12
0
 public static CacheConfiguration GetDefaultCacheServerConfiguration(this CoreServices services)
 {
     Init();
     return(_defaultCacheConfiguration);
 }
Ejemplo n.º 13
0
 public static void SetDefaultCacheClientSettings(this CoreServices services, CacheSettings settings)
 {
     _init     = Interlocked.Exchange(ref _init, 1);
     _settings = settings;
 }