示例#1
0
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            // need to call base run async to prepare for the state or else actor state will throw errors ReminderLoadInProgressException
            await base.RunAsync(cancellationToken);

            var config = ServiceConfig.GetConfigSection(SectionKeyName);

            //read the blob and init scheduler actor

            if (ConfigMode == ConfigMode.BlobConfig)
            {
                var configList = await BlobStorageConfiguration.GetConfigsFromBlobFile <ServiceBusOption>(
                    config[CONNECTION_STRING_KEY],
                    config[CONTAINER_NAME_KEY],
                    config[FILE_NAME_KEY],
                    $"{SectionKeyName}");

                foreach (var option in configList)
                {
                    Logger.LogInformation($"[{SectionKeyName}] Initialize Listener Actor", option);
                    await InitScalingListenersAsync(option, cancellationToken);
                }
            }
            else if (ConfigMode == ConfigMode.ServiceFabricConfig)
            {
                var serviceBusOption = new ServiceBusOption()
                {
                    ConnectionString           = config[CONNECTION_STRING_KEY],
                    ClientMode                 = ClientMode.Receiving,
                    SubscriptionRequireSession = false,
                    SubscriptionName           = $"{SectionKeyName}_sub_no_sessionId"
                };
                await InitScalingListenersAsync(serviceBusOption, cancellationToken);
            }
        }
        private async Task <IEnumerable <FtpOption> > GetFtpConfigsAsync()
        {
            var config     = _serviceConfiguration.GetConfigSection(SectionKeyName);
            var configList = await _blobStorageConfiguration.GetConfigsFromBlobFile <FtpOption>(
                config[CONNECTION_STRING_KEY],
                config[CONTAINER_NAME_KEY],
                config[FILE_NAME_KEY],
                $"{SectionKeyName}");

            return(configList);
        }