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); })); }
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; }