Exemple #1
0
 void UpdateStoreAndForwardConfig(StoreAndForwardConfiguration storeAndForwardConfiguration)
 {
     if (storeAndForwardConfiguration != null)
     {
         this.messageStore?.SetTimeToLive(storeAndForwardConfiguration.TimeToLive);
         Events.UpdatedStoreAndForwardConfiguration();
     }
 }
 void UpdateStoreAndForwardConfig(StoreAndForwardConfiguration storeAndForwardConfiguration)
 {
     if (storeAndForwardConfiguration != null)
     {
         this.messageStore?.SetTimeToLive(TimeSpan.FromSeconds(storeAndForwardConfiguration.TimeToLiveSecs));
         Events.UpdatedStoreAndForwardConfiguration();
     }
 }
 public EdgeHubDesiredProperties_1_0(
     string schemaVersion,
     IDictionary <string, string> routes,
     StoreAndForwardConfiguration storeAndForwardConfiguration)
 {
     this.SchemaVersion = schemaVersion;
     this.Routes        = routes;
     this.StoreAndForwardConfiguration = storeAndForwardConfiguration;
 }
 public EdgeHubDesiredProperties_1_1(
     string schemaVersion,
     IDictionary <string, RouteSpec> routes,
     StoreAndForwardConfiguration storeAndForwardConfiguration)
 {
     this.SchemaVersion = Preconditions.CheckNonWhiteSpace(schemaVersion, nameof(schemaVersion));
     this.Routes        = Preconditions.CheckNotNull(routes, nameof(routes));
     this.StoreAndForwardConfiguration = Preconditions.CheckNotNull(storeAndForwardConfiguration, nameof(storeAndForwardConfiguration));
 }
Exemple #5
0
 public EdgeHubConfig(
     string schemaVersion,
     IReadOnlyDictionary <string, RouteConfig> routes,
     StoreAndForwardConfiguration storeAndForwardConfiguration,
     Option <BrokerConfig> brokerConfiguration)
 {
     this.SchemaVersion = Preconditions.CheckNonWhiteSpace(schemaVersion, nameof(schemaVersion));
     this.Routes        = Preconditions.CheckNotNull(routes, nameof(routes));
     this.StoreAndForwardConfiguration = Preconditions.CheckNotNull(storeAndForwardConfiguration, nameof(storeAndForwardConfiguration));
     this.BrokerConfiguration          = brokerConfiguration;
 }
Exemple #6
0
 public EdgeHubDesiredProperties_1_2(
     string schemaVersion,
     IDictionary <string, RouteSpec> routes,
     StoreAndForwardConfiguration storeAndForwardConfiguration,
     BrokerProperties brokerConfiguration)
 {
     this.SchemaVersion = Preconditions.CheckNonWhiteSpace(schemaVersion, nameof(schemaVersion));
     this.Routes        = Preconditions.CheckNotNull(routes, nameof(routes));
     this.StoreAndForwardConfiguration = Preconditions.CheckNotNull(storeAndForwardConfiguration, nameof(storeAndForwardConfiguration));
     // can be null for old versions.
     this.BrokerConfiguration = brokerConfiguration;
 }
Exemple #7
0
        void UpdateStoreAndForwardConfig(StoreAndForwardConfiguration storeAndForwardConfiguration)
        {
            if (storeAndForwardConfiguration != null)
            {
                this.messageStore?.SetTimeToLive(storeAndForwardConfiguration.TimeToLive);

                if (storeAndForwardConfiguration.StoreLimits.HasValue)
                {
                    storeAndForwardConfiguration.StoreLimits.ForEach(x => this.storageSpaceChecker.SetMaxSizeBytes(Option.Some(x.MaxSizeBytes)));
                }
                else
                {
                    this.storageSpaceChecker.SetMaxSizeBytes(Option.None <long>());
                }

                Events.UpdatedStoreAndForwardConfiguration();
            }
        }
Exemple #8
0
        public LocalConfigSource(
            RouteFactory routeFactory,
            IDictionary <string, string> routes,
            StoreAndForwardConfiguration storeAndForwardConfiguration)
        {
            Preconditions.CheckNotNull(routeFactory, nameof(routeFactory));
            Preconditions.CheckNotNull(routes, nameof(routes));
            Preconditions.CheckNotNull(storeAndForwardConfiguration, nameof(storeAndForwardConfiguration));

            IDictionary <string, RouteConfig> parsedRoutes = routes.ToDictionary(
                r => r.Key,
                r => new RouteConfig(r.Key, r.Value, routeFactory.Create(r.Value)));

            this.edgeHubConfig = new EdgeHubConfig(
                Constants.LatestSchemaVersion.ToString(),
                new ReadOnlyDictionary <string, RouteConfig>(parsedRoutes),
                storeAndForwardConfiguration,
                Option.None <BrokerConfig>());
        }
Exemple #9
0
        public LocalConfigSource(RouteFactory routeFactory, IDictionary <string, string> routes, StoreAndForwardConfiguration storeAndForwardConfiguration)
        {
            Preconditions.CheckNotNull(routeFactory, nameof(routeFactory));
            Preconditions.CheckNotNull(routes, nameof(routes));
            Preconditions.CheckNotNull(storeAndForwardConfiguration, nameof(storeAndForwardConfiguration));
            IEnumerable <(string Name, string Value, Route Route)> parsedRoutes = routes.Select(r => (r.Key, r.Value, routeFactory.Create(r.Value)));

            this.edgeHubConfig = new EdgeHubConfig(Core.Constants.ConfigSchemaVersion.ToString(), parsedRoutes, storeAndForwardConfiguration);
        }