public IOutboundTransport BuildOutbound(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); } 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); } }
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 CreateMsmqTransportSettings(Uri uri) : this() { Guard.Against.Null(uri, "The URI cannot be null"); Address = new MsmqEndpointAddress(uri); }
public CreateMsmqTransportSettings(IEndpointAddress address) : this() { Guard.Against.Null(address, "The address cannot be null"); Address = new MsmqEndpointAddress(address.Uri); }
public IInboundTransport BuildInbound(ITransportSettings settings) { try { var msmqEndpointAddress = new MsmqEndpointAddress(settings.Address.Uri, settings.Transactional); var 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); } }
private void SetDefaultErrorAddress() { Uri uri = Address.Uri; var errorUri = new UriBuilder(uri.Scheme, uri.Host, uri.Port, uri.AbsolutePath + "_error", uri.Query); ErrorAddress = new MsmqEndpointAddress(errorUri.Uri); }
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); } }
static TransportSettings GetTransportSettings(ITransportSettings settings, MsmqEndpointAddress msmqEndpointAddress) { var msmqSettings = new TransportSettings(msmqEndpointAddress, settings) { Transactional = msmqEndpointAddress.IsTransactional, }; return msmqSettings; }
public CreateMsmqTransportSettings(IEndpointAddress address, CreateMsmqTransportSettings source) : this() { Guard.Against.Null(address, "The address cannot be null"); Guard.Against.Null(source, "The source settings cannot be null"); Address = new MsmqEndpointAddress(address.Uri); Transactional = source.Transactional; }
public static IEndpointManagement New(Uri uri) { try { var address = new MsmqEndpointAddress(uri); return(New(address)); } catch (UriFormatException ex) { throw new EndpointException(uri, "The MSMQ queue address is invalid.", ex); } }
public CreateMsmqTransportSettings(string uri) : this() { Guard.Against.NullOrEmpty(uri, "The URI cannot be null or empty"); try { Address = new MsmqEndpointAddress(new Uri(uri)); } catch (UriFormatException ex) { throw new ArgumentException("The URI is invalid: " + uri, ex); } }
static TransportSettings GetTransportSettings(ITransportSettings settings, MsmqEndpointAddress msmqEndpointAddress) { var msmqSettings = new TransportSettings(msmqEndpointAddress, settings) { CreateIfMissing = settings.CreateIfMissing, IsolationLevel = settings.IsolationLevel, PurgeExistingMessages = settings.PurgeExistingMessages, RequireTransactional = settings.RequireTransactional, Transactional = msmqEndpointAddress.IsTransactional, TransactionTimeout = settings.TransactionTimeout, }; return(msmqSettings); }
public IDuplexTransport BuildLoopback(ITransportSettings settings) { try { var msmqEndpointAddress = new MsmqEndpointAddress(settings.Address.Uri); var msmqSettings = GetTransportSettings(settings, msmqEndpointAddress); IInboundTransport inboundTransport = BuildInbound(settings); IOutboundTransport outboundTransport = BuildOutbound(settings); return new Transport(msmqSettings.Address, () => inboundTransport, () => outboundTransport); } catch (Exception ex) { throw new TransportException(settings.Address.Uri, "Failed to create MSMQ transport", ex); } }
public IDuplexTransport BuildLoopback(ITransportSettings settings) { try { var msmqEndpointAddress = new MsmqEndpointAddress(settings.Address.Uri, settings.Transactional); TransportSettings msmqSettings = GetTransportSettings(settings, msmqEndpointAddress); IInboundTransport inboundTransport = BuildInbound(settings); IOutboundTransport outboundTransport = BuildOutbound(settings); return(new Transport(msmqSettings.Address, () => inboundTransport, () => outboundTransport)); } catch (Exception ex) { throw new TransportException(settings.Address.Uri, "Failed to create MSMQ transport", ex); } }
public static IEndpointManagement New(Uri uri) { try { var address = new MsmqEndpointAddress(uri); return New(address); } catch (UriFormatException ex) { throw new EndpointException(uri, "The MSMQ queue address is invalid.", ex); } }
static TransportSettings GetTransportSettings(ITransportSettings settings, MsmqEndpointAddress msmqEndpointAddress) { var msmqSettings = new TransportSettings(msmqEndpointAddress, settings) { CreateIfMissing = settings.CreateIfMissing, IsolationLevel = settings.IsolationLevel, PurgeExistingMessages = settings.PurgeExistingMessages, RequireTransactional = settings.RequireTransactional, Transactional = msmqEndpointAddress.IsTransactional, TransactionTimeout = settings.TransactionTimeout, }; return msmqSettings; }