Esempio n. 1
0
		public IOutboundTransport BuildOutbound(ITransportSettings settings)
		{
			try
			{
				var msmqEndpointAddress = new MsmqEndpointAddress(settings.Address.Uri);
				var msmqSettings = new TransportSettings(msmqEndpointAddress, settings)
				{
					Transactional = msmqEndpointAddress.IsTransactional
				};

				if (msmqSettings.MsmqAddress().IsLocal)
				{
					ValidateLocalTransport(msmqSettings);
				}

				if (msmqSettings.Transactional)
					return new TransactionalOutboundMsmqTransport(msmqSettings.MsmqAddress());

				return new NonTransactionalOutboundMsmqTransport(msmqSettings.MsmqAddress());
			}
			catch (Exception ex)
			{
				throw new TransportException(settings.Address.Uri, "Failed to create MSMQ outbound transport", ex);
			}
		}
Esempio n. 2
0
		public IInboundTransport BuildInbound(ITransportSettings settings)
		{
			try
			{
				var msmqEndpointAddress = new MsmqEndpointAddress(settings.Address.Uri);
				var msmqSettings = new TransportSettings(msmqEndpointAddress, settings)
					{
						Transactional = msmqEndpointAddress.IsTransactional
					};

				if (msmqSettings.MsmqAddress().IsLocal)
				{
					ValidateLocalTransport(msmqSettings);

					PurgeExistingMessagesIfRequested(msmqSettings);
				}

				if (msmqSettings.Transactional)
					return new TransactionalInboundMsmqTransport(msmqSettings.MsmqAddress(),
						msmqSettings.TransactionTimeout, msmqSettings.IsolationLevel);

				return new NonTransactionalInboundMsmqTransport(msmqSettings.MsmqAddress());
			}
			catch (Exception ex)
			{
				throw new TransportException(settings.Address.Uri, "Failed to create MSMQ inbound transport", ex);
			}
		}
        public IInboundTransport BuildInbound(ITransportSettings settings)
        {
            try
            {
                var msmqEndpointAddress = new MsmqEndpointAddress(settings.Address.Uri);
                var msmqSettings = new TransportSettings(msmqEndpointAddress, settings)
                    {
                        Transactional = settings.Transactional || msmqEndpointAddress.IsTransactional
                    };

                IMsmqEndpointAddress transportAddress = msmqSettings.MsmqAddress();

                if (transportAddress.IsLocal)
                {
                    ValidateLocalTransport(msmqSettings);

                    PurgeExistingMessagesIfRequested(msmqSettings);
                }

                var connection = new MessageQueueConnection(transportAddress, QueueAccessMode.Receive);
                var connectionHandler = new ConnectionHandlerImpl<MessageQueueConnection>(connection);

                if (msmqSettings.Transactional)
                    return new TransactionalInboundMsmqTransport(transportAddress, connectionHandler,
                        msmqSettings.TransactionTimeout, msmqSettings.IsolationLevel);

                return new NonTransactionalInboundMsmqTransport(transportAddress, connectionHandler);
            }
            catch (Exception ex)
            {
                throw new TransportException(settings.Address.Uri, "Failed to create MSMQ inbound transport", ex);
            }
        }
Esempio n. 4
0
        public IOutboundTransport BuildOutbound(ITransportSettings settings)
        {
            try
            {
                var msmqEndpointAddress        = new MsmqEndpointAddress(settings.Address.Uri, settings.Transactional);
                TransportSettings msmqSettings = GetTransportSettings(settings, msmqEndpointAddress);

                IMsmqEndpointAddress transportAddress = msmqSettings.MsmqAddress();

                if (transportAddress.IsLocal)
                {
                    ValidateLocalTransport(msmqSettings);
                }

                var connection        = new MessageQueueConnection(transportAddress, QueueAccessMode.Send);
                var connectionHandler = new ConnectionHandlerImpl <MessageQueueConnection>(connection);

                if (msmqSettings.Transactional)
                {
                    return(new TransactionalOutboundMsmqTransport(transportAddress, connectionHandler));
                }

                return(new NonTransactionalOutboundMsmqTransport(transportAddress, connectionHandler));
            }
            catch (Exception ex)
            {
                throw new TransportException(settings.Address.Uri, "Failed to create MSMQ outbound transport", ex);
            }
        }
Esempio n. 5
0
        public IInboundTransport BuildInbound(ITransportSettings settings)
        {
            try
            {
                var msmqEndpointAddress        = new MsmqEndpointAddress(settings.Address.Uri, settings.Transactional);
                TransportSettings msmqSettings = GetTransportSettings(settings, msmqEndpointAddress);

                IMsmqEndpointAddress transportAddress = msmqSettings.MsmqAddress();

                if (transportAddress.IsLocal)
                {
                    ValidateLocalTransport(msmqSettings);

                    PurgeExistingMessagesIfRequested(msmqSettings);
                }

                var connection        = new MessageQueueConnection(transportAddress, QueueAccessMode.Receive);
                var connectionHandler = new ConnectionHandlerImpl <MessageQueueConnection>(connection);

                if (msmqSettings.Transactional)
                {
                    return(new TransactionalInboundMsmqTransport(transportAddress, connectionHandler,
                                                                 msmqSettings.TransactionTimeout, msmqSettings.IsolationLevel));
                }

                return(new NonTransactionalInboundMsmqTransport(transportAddress, connectionHandler));
            }
            catch (Exception ex)
            {
                throw new TransportException(settings.Address.Uri, "Failed to create MSMQ inbound transport", ex);
            }
        }
		public IInboundTransport BuildInbound(ITransportSettings settings)
		{
			try
			{
				ITransportSettings msmqSettings = new TransportSettings(new MsmqEndpointAddress(settings.Address.Uri), settings);

				if (msmqSettings.MsmqAddress().IsLocal)
				{
					ValidateLocalTransport(msmqSettings);

					PurgeExistingMessagesIfRequested(msmqSettings);
				}

				return new NonTransactionalInboundMsmqTransport(msmqSettings.MsmqAddress());
			}
			catch (Exception ex)
			{
				throw new TransportException(settings.Address.Uri, "Failed to create MSMQ inbound transport", ex);
			}
		}
		public IOutboundTransport BuildOutbound(ITransportSettings settings)
		{
			try
			{
				ITransportSettings msmqSettings = new TransportSettings(new MsmqEndpointAddress(settings.Address.Uri), settings);

				IMsmqEndpointAddress transportAddress = msmqSettings.MsmqAddress();

				if (transportAddress.IsLocal)
				{
					ValidateLocalTransport(msmqSettings);
				}

				var connection = new MessageQueueConnection(transportAddress, QueueAccessMode.Send);
				var connectionHandler = new ConnectionHandlerImpl<MessageQueueConnection>(connection);

				return new NonTransactionalOutboundMsmqTransport(transportAddress, connectionHandler);
			}
			catch (Exception ex)
			{
				throw new TransportException(settings.Address.Uri, "Failed to create MSMQ outbound transport", ex);
			}
		}