コード例 #1
0
        public override TransportSendInfrastructure ConfigureSendInfrastructure()
        {
            new CheckMachineNameForComplianceWithDtcLimitation().Check();

            Func <IReadOnlyDictionary <string, string>, string> getMessageLabel;

            settings.TryGet("Msmq.GetMessageLabel", out getMessageLabel);

            Func <IReadOnlyDictionary <string, string>, string> messageLabelGenerator;

            if (!settings.TryGet("msmqLabelGenerator", out messageLabelGenerator))
            {
                messageLabelGenerator = headers => string.Empty;
            }

            var msmqSettings = settings.Get <MsmqSettings>();

            return(new TransportSendInfrastructure(
                       () => new MsmqMessageDispatcher(msmqSettings, messageLabelGenerator),
                       () =>
            {
                var bindings = settings.Get <QueueBindings>();

                foreach (var address in bindings.SendingAddresses)
                {
                    QueuePermissions.CheckQueue(address);
                }

                var result = new MsmqTimeToBeReceivedOverrideCheck(settings).CheckTimeToBeReceivedOverrides();
                return Task.FromResult(result);
            }));
        }
コード例 #2
0
        public override TransportSendInfrastructure ConfigureSendInfrastructure()
        {
            new CheckMachineNameForComplianceWithDtcLimitation().Check();

            Func<IReadOnlyDictionary<string, string>, string> getMessageLabel;
            settings.TryGet("Msmq.GetMessageLabel", out getMessageLabel);

            Func<IReadOnlyDictionary<string, string>, string> messageLabelGenerator;
            if (!settings.TryGet("msmqLabelGenerator", out messageLabelGenerator))
            {
                messageLabelGenerator = headers => string.Empty;
            }

            var msmqSettings = settings.Get<MsmqSettings>();

            return new TransportSendInfrastructure(
                () => new MsmqMessageDispatcher(msmqSettings, messageLabelGenerator),
                () =>
                {
                    var bindings = settings.Get<QueueBindings>();

                    foreach (var address in bindings.SendingAddresses)
                    {
                        QueuePermissions.CheckQueue(address);
                    }

                    var result = new MsmqTimeToBeReceivedOverrideCheck(settings).CheckTimeToBeReceivedOverrides();
                    return Task.FromResult(result);
                });
        }