コード例 #1
0
 public void UpdateProducerOptions(string bindingName, ProducerOptions producerOptions)
 {
     if (Bindings.ContainsKey(bindingName))
     {
         Bindings[bindingName].Producer = producerOptions;
     }
 }
コード例 #2
0
        internal void PostProcess(string name, ProducerOptions @default = null)
        {
            BindingName = name;

            if (!ErrorChannelEnabled.HasValue)
            {
                ErrorChannelEnabled = (@default != null) ? @default.ErrorChannelEnabled : IsErrorChannelEnabled_Default;
            }

            if (!UseNativeEncoding.HasValue)
            {
                UseNativeEncoding = (@default != null) ? @default.UseNativeEncoding : UseNativeEncoding_Default;
            }

            if (!HeaderMode.HasValue)
            {
                HeaderMode = (@default != null) ? @default.HeaderMode : Config.HeaderMode.None;
            }

            if (RequiredGroups == null)
            {
                RequiredGroups = (@default != null) ? @default.RequiredGroups : new List <string>();
            }

            if (PartitionCount == int.MinValue)
            {
                PartitionCount = (@default != null) ? @default.PartitionCount : PartitionCount_Default;
            }

            if (PartitionSelectorExpression == null)
            {
                PartitionSelectorExpression = @default?.PartitionSelectorExpression;
            }

            if (PartitionSelectorName == null)
            {
                PartitionSelectorName = @default?.PartitionSelectorName;
            }

            if (PartitionKeyExtractorName == null)
            {
                PartitionKeyExtractorName = @default?.PartitionKeyExtractorName;
            }

            if (PartitionKeyExpression == null)
            {
                PartitionKeyExpression = @default?.PartitionKeyExpression;
            }

            if (!AutoStartup.HasValue)
            {
                AutoStartup = (@default != null) ? @default.AutoStartup : AutoStartup_Default;
            }
        }
コード例 #3
0
        public ProducerOptions GetProducerOptions(string outputBindingName)
        {
            if (outputBindingName == null)
            {
                throw new ArgumentNullException(nameof(outputBindingName));
            }

            var bindingOptions = GetBindingOptions(outputBindingName);

            if (bindingOptions.Producer is not ProducerOptions producerOptions)
            {
                producerOptions = new ProducerOptions();
                producerOptions.PostProcess(outputBindingName, Default.Producer);
                bindingOptions.Producer = producerOptions;
            }

            return(producerOptions);
        }