示例#1
0
        public IPrioritizedProcessingGroup GetProcessingGroup(string transportId, string name, Action onFailure = null)
        {
            ResolvedTransport transport = resolveTransport(transportId);

            try
            {
                return(transport.GetProcessingGroup(transportId, name, onFailure));
            }
            catch (Exception e)
            {
                throw new TransportException(string.Format("Failed to create processing group {0} on transport {1}", name, transportId), e);
            }
        }
示例#2
0
        public bool VerifyDestination(string transportId, Destination destination, EndpointUsage usage, bool configureIfRequired, out string error)
        {
            ResolvedTransport transport = resolveTransport(transportId);

            try
            {
                return(transport.VerifyDestination(destination, usage, configureIfRequired, out error));
            }
            catch (Exception e)
            {
                throw new TransportException(string.Format("Destination {0} is not properly configured on transport {1}", destination, transportId), e);
            }
        }
示例#3
0
        private ResolvedTransport resolveTransport(string transportId)
        {
            if (m_IsDisposed.WaitOne(0))
            {
                throw new ObjectDisposedException(string.Format("Can not create transport {0}. TransportManager instance is disposed", transportId));
            }


            var transportInfo = m_TransportResolver.GetTransport(transportId);

            if (transportInfo == null)
            {
                throw new ConfigurationErrorsException(string.Format("Transport '{0}' is not resolvable", transportId));
            }
            var factory = m_TransportFactories.FirstOrDefault(f => f.Name == transportInfo.Messaging);

            if (factory == null)
            {
                throw new ConfigurationErrorsException(string.Format("Can not create transport '{0}', {1} messaging is not supported", transportId,
                                                                     transportInfo.Messaging));
            }

            ResolvedTransport transport;

            if (!m_Transports.TryGetValue(transportInfo, out transport))
            {
                lock (m_Transports)
                {
                    if (!m_Transports.TryGetValue(transportInfo, out transport))
                    {
                        transport = new ResolvedTransport(transportInfo, () => ProcessTransportFailure(transportInfo), factory);
                        m_Transports.Add(transportInfo, transport);
                    }
                }
            }
            return(transport);
        }