コード例 #1
0
        public StatsSampleSpecConfig()
        {
            First  = Role("first");
            Second = Role("second");
            Third  = Role("third");

            // this configuration will be used for all nodes
            // note that no fixed host names and ports are used
            CommonConfig = ConfigurationFactory.ParseString(@"
                # Enable metrics extension in akka-cluster-metrics.
                akka.extensions=[""Akka.Cluster.Metrics.ClusterMetricsExtensionProvider, Akka.Cluster.Metrics""]

                akka.actor.provider = cluster
                akka.remote.classic.log-remote-lifecycle-events = off
                akka.cluster.roles = [compute]
                #//#router-lookup-config
                akka.actor.deployment {
                  /statsService/workerRouter {
                      router = consistent-hashing-group
                      routees.paths = [""/user/statsWorker""]
                        cluster {
                            enabled = on
                            allow-local-routees = on
                            use-roles = [""compute""]
                        }
                    }
                }
                #//#router-lookup-config
            ");
        }
コード例 #2
0
 static ReplicatorSpecs()
 {
     SpecConfig = ConfigurationFactory.ParseString(@"
         akka.loglevel = DEBUG
         akka.actor.provider = cluster
         akka.remote.dot-netty.tcp.port = 0")
                  .WithFallback(DistributedData.DefaultConfig());
 }
コード例 #3
0
ファイル: Dispatchers.cs プロジェクト: tamphuc0503/akka.net
        private Config Config(string id, Config appConfig)
        {
            var simpleName = id.Substring(id.LastIndexOf('.') + 1);

            return(IdConfig(id)
                   .WithFallback(appConfig)
                   .WithFallback(ConfigurationFactory.ParseString(string.Format("name: {0}", simpleName)))
                   .WithFallback(DefaultDispatcherConfig));
        }
コード例 #4
0
        public WeightedRouteesSpec()
            : base(ConfigurationFactory.ParseString(@"
                akka.actor.provider = ""cluster""
                akka.remote.classic.netty.tcp.port = 0
                akka.remote.artery.canonical.port = 0
            "))
        {
            _routeeA = new ActorSelectionRoutee(Sys.ActorSelection(new RootActorPath(_a1) / "user" / "a"));
            _routeeB = new ActorSelectionRoutee(Sys.ActorSelection(new RootActorPath(_b1) / "user" / "b"));
            _routeeC = new ActorSelectionRoutee(Sys.ActorSelection(new RootActorPath(_c1) / "user" / "c"));
            _routees = ImmutableArray.Create <Routee>(_routeeA, _routeeB, _routeeC);

            _testActorRoutee = new ActorRefRoutee(TestActor);
        }
コード例 #5
0
        [Fact] public void EventAdapters_should_fail_with_useful_message_when_binding_to_not_defined_adapter()
        {
            var badConfig      = ConfigurationFactory.ParseString(@"
akka.persistence.journal.inmem {
  event-adapter-bindings {
    ""System.Integer"" = undefined-adapter
  }
}");
            var combinedConfig = badConfig.GetConfig("akka.persistence.journal.inmem");

            var ex = Assert.Throws <ArgumentException>(() => EventAdapters.Create(_extendedActorSystem, combinedConfig));

            ex.Message.Contains("System.Integer was bound to undefined event-adapter: undefined-adapter").Should().BeTrue();
        }
コード例 #6
0
        public static Config Config()
        {
            var address = TestUtils.TemporaryServerAddress();

            return(ConfigurationFactory.ParseString($@"        
            akka {{
              loglevel = INFO
              actor {{
                provider = remote
                serialize-messages = off
              }}
              remote.dot-netty.tcp {{
                port = {address.Port}
                hostname = ""{address.Address}""
              }}
            }}")
                   .WithFallback(ConfigurationFactory.Default()));
        }
コード例 #7
0
        public AdaptiveLoadBalancingRouterConfig()
        {
            Node1 = Role("node-1");
            Node2 = Role("node-2");
            Node3 = Role("node-3");

            CommonConfig = DebugConfig(on: false)
                           .WithFallback(ConfigurationFactory.ParseString(@"
                    # Enable metrics extension in akka-cluster-metrics.
                    akka.extensions=[""Akka.Cluster.Metrics.ClusterMetricsExtensionProvider, Akka.Cluster.Metrics""]

                    akka.cluster.failure-detector.acceptable-heartbeat-pause = 10s

                    # Use rapid metrics collection.
                    akka.cluster.metrics {
                        collector {
                            sample-interval = 1s
                            gossip-interval = 1s
                            moving-average-half-life = 2s
                        }
                    }

                    # Use metrics extension routing.
                    akka.actor.deployment {
                        /router3 = {
                            router = cluster-metrics-adaptive-pool
                            metrics-selector = cpu
                            nr-of-instances = 9
                        }
                        /router4 = {
                            router = cluster-metrics-adaptive-pool
                            metrics-selector = ""Akka.Cluster.Metrics.Tests.MultiNode.TestCustomMetricsSelector, Akka.Cluster.Metrics.Tests.MultiNode""
                            nr-of-instances = 10
                            cluster {
                                enabled = on
                                max-nr-of-instances-per-node = 2
                            }
                        }
                    }
                "))
                           .WithFallback(ClusterMetrics.DefaultConfig())
                           .WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
コード例 #8
0
        public static ActorSystem CreateActorSystem()
        {
            var address = TestUtils.TemporaryServerAddress();
            var config  = ConfigurationFactory.ParseString($@"        
            akka {{
              loglevel = INFO
              actor {{
                provider = remote
                serialize-messages = off
              }}
              remote.dot-netty.tcp {{
                port = {address.Port}
                hostname = ""{address.Address}""
              }}
            }}")
                          .WithFallback(ConfigurationFactory.Default());

            var system = ActorSystem.Create("remote-system-2", config);

            return(system);
        }
コード例 #9
0
        public void Should_be_able_to_parse_settings()
        {
            var config = Sys.Settings.Config.WithFallback(
                ConfigurationFactory.FromResource <ClusterMetricsSettings>("Akka.Cluster.Metrics.reference.conf"));
            var settings = new ClusterMetricsSettings(config);

            // Extension.
            settings.MetricsDispatcher.ShouldBe(Dispatchers.DefaultDispatcherId);
            settings.PeriodicTasksInitialDelay.Should().Be(1.Seconds());

            // Supervisor.
            settings.SupervisorName.Should().Be("cluster-metrics");
            settings.SupervisorStrategyProvider.Should().BeEquivalentTo(typeof(ClusterMetricsStrategy).TypeQualifiedName());
            settings.SupervisorStrategyConfiguration.ToString().ShouldBeEquivalentTo(
                ConfigurationFactory.ParseString("loggingEnabled=true,withinTimeRange=3s,maxNrOfRetries=3").ToString());

            // Collector.
            settings.CollectorEnabled.Should().BeTrue();
            settings.CollectorProvider.Should().BeEmpty();
            settings.CollectorSampleInterval.Should().Be(3.Seconds());
            settings.CollectorGossipInterval.Should().Be(3.Seconds());
            settings.CollectorMovingAverageHalfLife.Should().Be(12.Seconds());
        }
コード例 #10
0
        public MemoryEventAdaptersSpec()
        {
            var config = ConfigurationFactory.ParseString(@"
akka.persistence.journal {
  plugin = ""akka.persistence.journal.inmem""


  # adapters defined for all plugins
  common-event-adapter-bindings {
  }

  inmem {
    # showcases re-using and concating configuration of adapters

    event-adapters {
      example  = """ + typeof(ExampleEventAdapter).FullName + @", Akka.Persistence.Tests""
      marker   = """ + typeof(MarkerInterfaceAdapter).FullName + @", Akka.Persistence.Tests""
      precise  = """ + typeof(PreciseAdapter).FullName + @", Akka.Persistence.Tests""
      reader  = """ + typeof(ReaderAdapter).FullName + @", Akka.Persistence.Tests""
      writer  = """ + typeof(WriterAdapter).FullName + @", Akka.Persistence.Tests""
      another-reader  = """ + typeof(AnotherReaderAdapter).FullName + @", Akka.Persistence.Tests""
    }
    event-adapter-bindings = {
      """ + typeof(IEventMarkerInterface).FullName + @", Akka.Persistence.Tests"" = marker
      ""System.String"" = example
      """ + typeof(PreciseAdapterEvent).FullName + @", Akka.Persistence.Tests"" = precise
      """ + typeof(ReadMeEvent).FullName + @", Akka.Persistence.Tests"" = reader
      """ + typeof(WriteMeEvent).FullName + @", Akka.Persistence.Tests"" = writer
      """ + typeof(ReadMeTwiceEvent).FullName + @", Akka.Persistence.Tests"" = [reader, another-reader]
      """ + typeof(ReadWriteEvent).FullName + @", Akka.Persistence.Tests"" = [reader, another-reader, writer]
    }
  }
}").WithFallback(ConfigurationFactory.Default());

            _extendedActorSystem = (ExtendedActorSystem)Sys;
            _memoryConfig        = config.GetConfig("akka.persistence.journal.inmem");
        }
コード例 #11
0
ファイル: Dispatchers.cs プロジェクト: tamphuc0503/akka.net
 private Config IdConfig(string id)
 {
     return(ConfigurationFactory.ParseString(string.Format("id: {0}", id)));
 }
コード例 #12
0
ファイル: Config.cs プロジェクト: piksel/HOCON
        /// <summary>
        /// Adds the supplied configuration as a fallback to the supplied configuration string.
        /// </summary>
        /// <param name="configHocon">The configuration string used as the source.</param>
        /// <param name="fallbackConfig">The configuration used as the fallback.</param>
        /// <returns>A configuration configured with the supplied fallback.</returns>
        public static Config operator +(string configHocon, Config fallbackConfig)
        {
            Config config = ConfigurationFactory.ParseString(configHocon);

            return(config.WithFallback(fallbackConfig));
        }
コード例 #13
0
ファイル: Config.cs プロジェクト: piksel/HOCON
        /// <summary>
        /// Adds the supplied configuration string as a fallback to the supplied configuration.
        /// </summary>
        /// <param name="config">The configuration used as the source.</param>
        /// <param name="fallback">The string used as the fallback configuration.</param>
        /// <returns>The supplied configuration configured with the supplied fallback.</returns>
        public static Config operator +(Config config, string fallback)
        {
            Config fallbackConfig = ConfigurationFactory.ParseString(fallback);

            return(config.WithFallback(fallbackConfig));
        }
コード例 #14
0
ファイル: Dispatchers.cs プロジェクト: jarlrasm/akka.net
 private static Config IdConfig(string id)
 {
     return(ConfigurationFactory.ParseString($"id: {id}"));
 }