public static KafkaRocksJournalSettings Create(Config config, Akka.Serialization.Serialization serialization)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var cfg     = config.GetValue("enableForTopicPartitions");
            var tpoCfgs = cfg.Values.First() as HoconArray;

            var tpos = new List <TopicPartition>();

            foreach (var hoconValue in tpoCfgs)
            {
                var tpoCfg    = hoconValue.GetObject();
                var topic     = tpoCfg.Items["topic"].GetString();
                var partition = tpoCfg.Items["partition"].GetInt();

                tpos.Add(new TopicPartition(topic, new Partition(partition)));
            }

            return(new KafkaRocksJournalSettings(
                       config.GetString("eventTopicMapperClassname"),
                       config.GetConfig("kafka"),
                       serialization,
                       tpos,
                       RocksDbSettings.Create(config.GetConfig("rocksdb"))));
        }
Esempio n. 2
0
        public LmdbEventLogSettings(Config config)
        {
            this.ReadTimeout = config.GetTimeSpan("eventuate.log.read-timeout");

            var lmdb = config.GetConfig("eventuate.log.lmdb");

            this.RootDir            = lmdb.GetString("dir");
            this.DbName             = lmdb.GetString("db-name");
            this.StateSnapshotLimit = lmdb.GetInt("state-snapshot-limit");
            this.DeletionBatchSize  = lmdb.GetInt("deletion-batch-size");
            this.DeletionRetryDelay = lmdb.GetTimeSpan("deletion-retry-delay");
        }
Esempio n. 3
0
        public static ProducerSettings <TKey, TValue> Create(Akka.Configuration.Config config, ISerializer <TKey> keySerializer, ISerializer <TValue> valueSerializer)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config), "Kafka config for Akka.NET producer was not provided");
            }

            var properties = config.GetConfig("kafka-clients").ParseKafkaClientsProperties();

            return(new ProducerSettings <TKey, TValue>(
                       keySerializer: keySerializer,
                       valueSerializer: valueSerializer,
                       parallelism: config.GetInt("parallelism", 100),
                       dispatcherId: config.GetString("use-dispatcher", "akka.kafka.default-dispatcher"),
                       flushTimeout: config.GetTimeSpan("flush-timeout", TimeSpan.FromSeconds(2)),
                       eosCommitInterval: config.GetTimeSpan("eos-commit-interval", TimeSpan.FromMilliseconds(100)),
                       properties: properties));
        }