예제 #1
0
        public override TransportReceiveInfrastructure ConfigureReceiveInfrastructure()
        {
            CheckMachineNameForCompliance.Check();

            // The following check avoids creating some sub-queues, if the endpoint sub queue has the capability to exceed the max length limitation for queue format name.
            foreach (var queue in queueBindings.ReceivingAddresses)
            {
                CheckEndpointNameComplianceForMsmq.Check(queue);
            }

            return(new TransportReceiveInfrastructure(
                       () => new MessagePump(guarantee => SelectReceiveStrategy(guarantee, msmqSettings.ScopeOptions.TransactionOptions)),
                       () =>
            {
                if (msmqSettings.ExecuteInstaller)
                {
                    return new MsmqQueueCreator(msmqSettings.UseTransactionalQueues);
                }
                return new NullQueueCreator();
            },
                       () =>
            {
                foreach (var address in queueBindings.ReceivingAddresses)
                {
                    QueuePermissions.CheckQueue(address);
                }
                return Task.FromResult(StartupCheckResult.Success);
            }));
        }
예제 #2
0
        public void SetupReceivers(ReceiveSettings[] receivers, Action <string, Exception, CancellationToken> criticalErrorAction)
        {
            var messagePumps = new Dictionary <string, IMessageReceiver>(receivers.Length);

            foreach (var receiver in receivers)
            {
                if (receiver.UsePublishSubscribe)
                {
                    throw new NotImplementedException("MSMQ does not support native pub/sub.");
                }

                // The following check avoids creating some sub-queues, if the endpoint sub queue has the capability to exceed the max length limitation for queue format name.
                CheckEndpointNameComplianceForMsmq.Check(receiver.ReceiveAddress);
                QueuePermissions.CheckQueue(receiver.ReceiveAddress);

                var pump = new MessagePump(
                    transactionMode =>
                    SelectReceiveStrategy(transactionMode, transportSettings.TransactionScopeOptions.TransactionOptions),
                    transportSettings.MessageEnumeratorTimeout,
                    criticalErrorAction,
                    transportSettings,
                    receiver);
                messagePumps.Add(pump.Id, pump);
            }

            Receivers = messagePumps;
        }
예제 #3
0
        public override TransportSendInfrastructure ConfigureSendInfrastructure()
        {
            CheckMachineNameForCompliance.Check();

            return(new TransportSendInfrastructure(
                       () => new MsmqMessageDispatcher(msmqSettings),
                       () =>
            {
                foreach (var address in queueBindings.SendingAddresses)
                {
                    QueuePermissions.CheckQueue(address);
                }

                var auditTTBROverridden = auditMessageExpiration > TimeSpan.Zero;
                var result = TimeToBeReceivedOverrideChecker.Check(isTransactional, outBoxRunning, auditTTBROverridden);
                return Task.FromResult(result);
            }));
        }