public MsmqSettings RetrieveSettings()
        {
            var settings = new MsmqSettings();

            if (ContainsKey("deadLetter"))
            {
                settings.UseDeadLetterQueue = bool.Parse((string)this["deadLetter"]);
            }

            if (ContainsKey("journal"))
            {
                settings.UseJournalQueue = bool.Parse((string)this["journal"]);
            }

            if (ContainsKey("cacheSendConnection"))
            {
                settings.UseConnectionCache = bool.Parse((string)this["cacheSendConnection"]);
            }

            if (ContainsKey("useTransactionalQueues"))
            {
                settings.UseTransactionalQueues = bool.Parse((string)this["useTransactionalQueues"]);
            }

            if (ContainsKey("timeToReachQueue"))
            {
                settings.TimeToReachQueue = TimeSpan.Parse((string)this["timeToReachQueue"]);
            }

            return(settings);
        }
        public MsmqSettings RetrieveSettings()
        {
            var settings = new MsmqSettings();

            if (ContainsKey("deadLetter"))
            {
                settings.UseDeadLetterQueue = bool.Parse((string) this["deadLetter"]);
            }

            if (ContainsKey("journal"))
            {
                settings.UseJournalQueue = bool.Parse((string) this["journal"]);
            }

            if (ContainsKey("cacheSendConnection"))
            {
                settings.UseConnectionCache = bool.Parse((string) this["cacheSendConnection"]);
            }

            if (ContainsKey("useTransactionalQueues"))
            {
                settings.UseTransactionalQueues = bool.Parse((string) this["useTransactionalQueues"]);
            }

            if (ContainsKey("timeToReachQueue"))
            {
                settings.TimeToReachQueue = TimeSpan.Parse((string) this["timeToReachQueue"]);
            }

            return settings;
        }
Exemple #3
0
        public MsmqMessageDispatcher(MsmqSettings settings, Func <IReadOnlyDictionary <string, string>, string> messageLabelGenerator)
        {
            Guard.AgainstNull(nameof(settings), settings);
            Guard.AgainstNull(nameof(messageLabelGenerator), messageLabelGenerator);

            this.settings = settings;
            this.messageLabelGenerator = messageLabelGenerator;
        }
        public MsmqMessageDispatcher(MsmqSettings settings, Func<IReadOnlyDictionary<string, string>, string> messageLabelGenerator)
        {
            Guard.AgainstNull(nameof(settings), settings);
            Guard.AgainstNull(nameof(messageLabelGenerator), messageLabelGenerator);

            this.settings = settings;
            this.messageLabelGenerator = messageLabelGenerator;
        }
        /// <summary>
        /// Initializes the transport infrastructure for msmq.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <returns>the transport infrastructure for msmq.</returns>
        public override TransportInfrastructure Initialize(SettingsHolder settings, string connectionString)
        {
            Guard.AgainstNull(nameof(settings), settings);

            if (!settings.GetOrDefault <bool>("Endpoint.SendOnly") && !settings.TryGetExplicitlyConfiguredErrorQueueAddress(out _))
            {
                throw new Exception("Faults forwarding requires an error queue to be specified using 'EndpointConfiguration.SendFailedMessagesTo()'");
            }

            if (connectionString != null)
            {
                var error = @"Passing in MSMQ settings such as DeadLetterQueue, Journaling etc via a connection string is no longer supported.  Use code level API. For example:
To turn off dead letter queuing, use: 
var transport = endpointConfiguration.UseTransport<MsmqTransport>();
transport.DisableDeadLetterQueueing();

To stop caching connections, use: 
var transport = endpointConfiguration.UseTransport<MsmqTransport>();
transport.DisableConnectionCachingForSends();

To use non-transactional queues, use:
var transport = endpointConfiguration.UseTransport<MsmqTransport>();
transport.UseNonTransactionalQueues();

To enable message journaling, use:
var transport = endpointConfiguration.UseTransport<MsmqTransport>();
transport.EnableJournaling();

To override the value of TTRQ, use:
var transport = endpointConfiguration.UseTransport<MsmqTransport>();
transport.TimeToReachQueue(timespanValue);";

                throw new Exception(error);
            }

            var msmqSettings = new MsmqSettings(settings);

            var isTransactional = IsTransactional(settings);
            var outBoxRunning   = settings.IsFeatureActive(typeof(Features.Outbox));

            settings.TryGetAuditMessageExpiration(out var auditMessageExpiration);

            return(new MsmqTransportInfrastructure(settings, msmqSettings, settings.Get <QueueBindings>(), isTransactional, outBoxRunning, auditMessageExpiration));
        }
Exemple #6
0
 public QueueCreator(MsmqSettings settings)
 {
     this.settings = settings;
 }