示例#1
0
        static void ValidateLocalTransport(ITransportSettings settings)
        {
            MsmqEndpointManagement.Manage(settings.Address, q =>
            {
                if (!q.Exists)
                {
                    if (!settings.CreateIfMissing)
                    {
                        throw new TransportException(settings.Address.Uri,
                                                     "The transport does not exist and automatic creation is not enabled");
                    }

                    q.Create(settings.Transactional || settings.Address.IsTransactional);
                }

                if (settings.RequireTransactional)
                {
                    if (!q.IsTransactional && (settings.Transactional || settings.Address.IsTransactional))
                    {
                        throw new TransportException(settings.Address.Uri,
                                                     "The transport is non-transactional but a transactional transport was requested");
                    }
                }
            });
        }
示例#2
0
 static void PurgeExistingMessagesIfRequested(ITransportSettings settings)
 {
     if (settings.Address.IsLocal && settings.PurgeExistingMessages)
     {
         MsmqEndpointManagement.Manage(settings.Address, x => x.Purge());
     }
 }
        private static LocalTransportSettings ValidateLocalTransport(CreateMsmqTransportSettings settings)
        {
            var result = new LocalTransportSettings
            {
                Transactional = settings.Address.IsTransactional,
            };

            MsmqEndpointManagement.Manage(settings.Address, q =>
            {
                if (!q.Exists)
                {
                    if (!settings.CreateIfMissing)
                    {
                        throw new TransportException(settings.Address.Uri,
                                                     "The transport does not exist and automatic creation is not enabled");
                    }

                    q.Create(settings.Transactional || settings.Address.IsTransactional);
                }

                if (settings.RequireTransactional)
                {
                    if (!q.IsTransactional && (settings.Transactional || settings.Address.IsTransactional))
                    {
                        throw new TransportException(settings.Address.Uri,
                                                     "The transport is non-transactional but a transactional transport was requested");
                    }
                }

                result.Transactional = q.IsTransactional;
            });

            return(result);
        }
        static void ValidateLocalTransport(ITransportSettings settings)
        {
            MsmqEndpointManagement.Manage(settings.Address, q =>
            {
                if (!q.Exists)
                {
                    if (!settings.CreateIfMissing)
                    {
                        throw new TransportException(settings.Address.Uri,
                                                     "The transport does not exist and automatic creation is not enabled");
                    }

                    q.Create(false);     // multicast queues cannot be transactional
                }
            });
        }