Esempio n. 1
0
        internal MessageBrokerOptions Build()
        {
            var messageBrokerOptions = new MessageBrokerOptions();

            if (_messageBrokerOptionsSection != null && _messageBrokerOptionsSection.Exists())
            {
                messageBrokerOptions = _messageBrokerOptionsSection.Get <MessageBrokerOptions>();
            }
            else
            {
                messageBrokerOptions.Reliability     = _reliabilityOptions;
                messageBrokerOptions.Recovery        = _recoveryOptions;
                messageBrokerOptions.TransactionMode = _transactionMode;
            }

            if (messageBrokerOptions.Reliability is null)
            {
                messageBrokerOptions.Reliability = ReliabilityOptionsBuilder.Create(Services).Build();
            }

            if (messageBrokerOptions.Recovery is null)
            {
                messageBrokerOptions.Recovery = RecoveryOptionsBuilder.Create(Services).Build();
            }

            Services.AddSingleton(messageBrokerOptions);

            return(messageBrokerOptions);
        }
Esempio n. 2
0
        public MessageBrokerOptionsBuilder AddReliabilityOptions(Action <ReliabilityOptionsBuilder> builder)
        {
            var b = ReliabilityOptionsBuilder.Create(Services);

            builder?.Invoke(b);
            _reliabilityOptions = b.Build();
            return(this);
        }