Ejemplo n.º 1
0
        public IReceiveTransport GetReceiveTransport(string queueName, ReceiveEndpointContext receiveEndpointContext)
        {
            LogContext.SetCurrentIfNull(DefaultLogContext);

            TransportLogMessages.CreateReceiveTransport(receiveEndpointContext.InputAddress);

            var queue = _messageFabric.GetQueue(queueName);

            IDeadLetterTransport deadLetterTransport = new InMemoryMessageDeadLetterTransport(_messageFabric.GetExchange($"{queueName}_skipped"));

            receiveEndpointContext.GetOrAddPayload(() => deadLetterTransport);

            IErrorTransport errorTransport = new InMemoryMessageErrorTransport(_messageFabric.GetExchange($"{queueName}_error"));

            receiveEndpointContext.GetOrAddPayload(() => errorTransport);

            var transport = new InMemoryReceiveTransport(new Uri(_hostConfiguration.HostAddress, queueName), queue, receiveEndpointContext);

            Add(transport);

            return(transport);
        }
Ejemplo n.º 2
0
        public IReceiveTransport GetReceiveTransport(string queueName, ReceiveEndpointContext receiveEndpointContext)
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Creating receive transport for queue: {0}", queueName);
            }

            var queue = _messageFabric.GetQueue(queueName);

            IDeadLetterTransport deadLetterTransport = new InMemoryMessageDeadLetterTransport(_messageFabric.GetExchange($"{queueName}_skipped"));

            receiveEndpointContext.GetOrAddPayload(() => deadLetterTransport);

            IErrorTransport errorTransport = new InMemoryMessageErrorTransport(_messageFabric.GetExchange($"{queueName}_error"));

            receiveEndpointContext.GetOrAddPayload(() => errorTransport);

            var transport = new InMemoryReceiveTransport(new Uri(_hostConfiguration.HostAddress, queueName), queue, receiveEndpointContext);

            Add(transport);

            return(transport);
        }
Ejemplo n.º 3
0
        public Task <ISendTransport> GetSendTransport(Uri address)
        {
            LogContext.SetCurrentIfNull(_hostConfiguration.LogContext);

            var endpointAddress = new GrpcEndpointAddress(HostAddress, address);

            TransportLogMessages.CreateSendTransport(address);

            var exchange = _messageFabric.GetExchange(HostNodeContext, endpointAddress.Name, endpointAddress.ExchangeType);

            var transportContext = new ExchangeGrpcSendTransportContext(_hostConfiguration, exchange);

            return(Task.FromResult <ISendTransport>(new GrpcSendTransport(transportContext)));
        }
Ejemplo n.º 4
0
        public async Task <ISendTransport> GetSendTransport(Uri address)
        {
            if (_sendEndpointProvider == null || _publishEndpointProvider == null || _topology == null)
            {
                throw new NotSupportedException("Okay, so somehow a send transport was requested first.");
            }

            var queueName = address.AbsolutePath.Split('/').Last();

            return(await _index.Get(queueName, async key =>
            {
                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Creating send transport for exchange: {0}", queueName);
                }

                var exchange = _messageFabric.GetExchange(queueName);

                var inMemorySendTransport = new InMemorySendTransport(exchange);

                return inMemorySendTransport;
            }));
        }