Exemple #1
0
        public IDuplexTransport BuildLoopback(ITransportSettings settings)
        {
            RabbitMqEndpointAddress address = RabbitMqEndpointAddress.Parse(settings.Address.Uri);

            var transport = new Transport(address, () => BuildInbound(settings), () => BuildOutbound(settings));

            return(transport);
        }
Exemple #2
0
        public IOutboundTransport BuildError(ITransportSettings settings)
        {
            RabbitMqEndpointAddress address = RabbitMqEndpointAddress.Parse(settings.Address.Uri);

            EnsureProtocolIsCorrect(address.Uri);

            ConnectionHandler <RabbitMqConnection> connection = GetConnection(address);

            return(new OutboundRabbitMqTransport(address, connection, true));
        }
Exemple #3
0
        public IInboundTransport BuildInbound(ITransportSettings settings)
        {
            RabbitMqEndpointAddress address = RabbitMqEndpointAddress.Parse(settings.Address.Uri);

            EnsureProtocolIsCorrect(address.Uri);

            ConnectionHandler <RabbitMqConnection> connectionHandler = GetConnection(address);

            return(new InboundRabbitMqTransport(address, connectionHandler, settings.PurgeExistingMessages));
        }
        public IDuplexTransport BuildLoopback(ITransportSettings settings)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("RabbitMQTransportFactory");
            }

            RabbitMqEndpointAddress address = RabbitMqEndpointAddress.Parse(settings.Address.Uri);

            var transport = new Transport(address, () => BuildInbound(settings), () => BuildOutbound(settings));

            return(transport);
        }
        public IOutboundTransport BuildError(ITransportSettings settings)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("RabbitMQTransportFactory");
            }

            RabbitMqEndpointAddress address = RabbitMqEndpointAddress.Parse(settings.Address.Uri);

            EnsureProtocolIsCorrect(address.Uri);

            ConnectionHandler <RabbitMqConnection> connection = GetConnection(_outboundConnections, address);

            return(new OutboundRabbitMqTransport(address, connection, true));
        }
Exemple #6
0
        public IInboundTransport BuildInbound(ITransportSettings settings)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("RabbitMQTransportFactory");
            }

            RabbitMqEndpointAddress address = RabbitMqEndpointAddress.Parse(settings.Address.Uri);

            EnsureProtocolIsCorrect(address.Uri);

            ConnectionHandler <RabbitMqConnection> connectionHandler = GetConnection(_connections, address);

            return(new InboundRabbitMqTransport(address, connectionHandler, settings.PurgeExistingMessages, _messageNameFormatter));
        }
        public void OnSubscriptionAdded(SubscriptionAdded message)
        {
            Guard.AgainstNull(_inputAddress, "InputAddress", "The input address was not set");

            Type messageType = Type.GetType(message.MessageName);

            if (messageType == null)
            {
                _log.InfoFormat("Unknown message type '{0}', unable to add subscription", message.MessageName);
                return;
            }

            MessageName messageName = _messageNameFormatter.GetMessageName(messageType);

            _inboundTransport.BindSubscriberExchange(RabbitMqEndpointAddress.Parse(message.EndpointUri), messageName.ToString());

            _bindings[message.SubscriptionId] = messageName;
        }
        public RabbitMqTransportFactory(
            IEnumerable <KeyValuePair <Uri, ConnectionFactoryBuilder> > connectionFactoryBuilders)
        {
            _inboundConnections = new ConcurrentCache <ConnectionFactory, ConnectionHandler <RabbitMqConnection> >(
                new ConnectionFactoryEquality());

            _outboundConnections = new ConcurrentCache <ConnectionFactory, ConnectionHandler <RabbitMqConnection> >(
                new ConnectionFactoryEquality());

            Dictionary <ConnectionFactory, ConnectionFactoryBuilder> builders = connectionFactoryBuilders
                                                                                .Select(x => new KeyValuePair <ConnectionFactory, ConnectionFactoryBuilder>(
                                                                                            RabbitMqEndpointAddress.Parse(x.Key).ConnectionFactory, x.Value))
                                                                                .ToDictionary(x => x.Key, x => x.Value);

            _connectionFactoryBuilders = new ConcurrentCache <ConnectionFactory, ConnectionFactoryBuilder>(builders,
                                                                                                           new ConnectionFactoryEquality());

            _messageNameFormatter = new RabbitMqMessageNameFormatter();
        }
 public IEndpointAddress GetAddress(Uri uri, bool transactional)
 {
     return(RabbitMqEndpointAddress.Parse(uri));
 }