Exemplo n.º 1
0
        public UnsubscribeAction SubscribedTo <TMessage>(Uri endpointUri)
            where TMessage : class
        {
            if (endpointUri == _bus.Endpoint.Address.Uri)
            {
                return(() => true);
            }

            IEndpoint endpoint = _bus.GetEndpoint(endpointUri);

            return(_pipeline.ConnectEndpoint <TMessage>(endpoint));
        }
        public UnsubscribeAction SubscribedTo <TMessage>(Uri endpointUri)
            where TMessage : class
        {
            // messages to the same bus that we're on should not be connected further
            if (endpointUri == _bus.Endpoint.Address.Uri)
            {
                return(() => true);
            }

            // other messages should be connected to the passed endpoint uri
            IEndpoint endpoint = _bus.GetEndpoint(endpointUri);

            return(_pipeline.ConnectEndpoint <TMessage>(endpoint));
        }
Exemplo n.º 3
0
        public void The_endpoint_consumer_should_be_returned()
        {
            var endpoint = MockRepository.GenerateMock <IEndpoint>();

            endpoint.Stub(x => x.Address.Uri).Return(new Uri("rabbitmq://localhost/queue_name"));

            _pipeline.ConnectEndpoint <PingMessage>(endpoint);

            PipelineViewer.Trace(_pipeline);

            var message = new PingMessage();

            ISendContext <PingMessage> context = new SendContext <PingMessage>(message);

            endpoint.Expect(x => x.Send(context)).IgnoreArguments();

            _pipeline.Dispatch(message);

            endpoint.VerifyAllExpectations();
        }