コード例 #1
0
        public async Task Should_properly_use_the_original_specification_plus_more()
        {
            var specification = new SendPipeSpecification();

            specification.GetMessageSpecification <MyMessage>()
            .UseExecute(context => Console.WriteLine("Hello, World."));

            specification.GetMessageSpecification <IMyMessage>()
            .UseExecute(context =>
            {
            });

            var endpointSpecification = new SendPipeSpecification();

            endpointSpecification.ConnectSendPipeSpecificationObserver(new ParentSendPipeSpecificationObserver(specification));

            endpointSpecification.GetMessageSpecification <IMyMessage>()
            .UseConcurrencyLimit(1);

            endpointSpecification.GetMessageSpecification <ITraceableMessage>()
            .UsePartitioner(8, x => NewId.NextGuid());

            IPipe <SendContext <MyMessage> > pipe = endpointSpecification.GetMessageSpecification <MyMessage>().BuildMessagePipe();

            var sendContext = new MessageSendContext <MyMessage>(new MyMessage());

            await pipe.Send(sendContext).ConfigureAwait(false);
        }
コード例 #2
0
        public async Task Should_properly_use_the_original_specification_plus_topology_on_type()
        {
            var sendTopology = new SendTopology();

            sendTopology.GetMessageTopology <IMyMessage>()
            .Add(new TestMessageSendTopology <IMyMessage>());

            var specification = new SendPipeSpecification();

            specification.ConnectSendPipeSpecificationObserver(new TopologySendPipeSpecificationObserver(sendTopology));

            specification.GetMessageSpecification <MyMessage>()
            .UseConsoleLog(context => Task.FromResult("Hello, World."));

            specification.GetMessageSpecification <IMyMessage>()
            .UseExecute(context =>
            {
            });

            var endpointSpecification = new SendPipeSpecification();

            endpointSpecification.ConnectSendPipeSpecificationObserver(new ParentSendPipeSpecificationObserver(specification));

            endpointSpecification.GetMessageSpecification <IMyMessage>()
            .UseConcurrencyLimit(1);

            endpointSpecification.GetMessageSpecification <ITraceableMessage>()
            .UsePartitioner(8, x => NewId.NextGuid());

            IPipe <SendContext <MyMessage> > pipe = endpointSpecification.GetMessageSpecification <MyMessage>().BuildMessagePipe();

            var sendContext = new InMemorySendContext <MyMessage>(new MyMessage());

            await pipe.Send(sendContext).ConfigureAwait(false);
        }
コード例 #3
0
        public async Task Should_properly_use_the_original_specification()
        {
            var specification = new SendPipeSpecification();

            specification.GetMessageSpecification <MyMessage>()
            .UseExecute(context => Console.WriteLine("Hello, World."));

            specification.GetMessageSpecification <IMyMessage>()
            .UseExecute(context =>
            {
            });

            var endpointSpecification = new SendPipeSpecification();

            endpointSpecification.ConnectSendPipeSpecificationObserver(new ParentSendPipeSpecificationObserver(specification));

            IPipe <SendContext <MyMessage> > pipe = endpointSpecification.GetMessageSpecification <MyMessage>().BuildMessagePipe();

            var sendContext = new InMemorySendContext <MyMessage>(new MyMessage());

            await pipe.Send(sendContext).ConfigureAwait(false);
        }
コード例 #4
0
 public SendPipeConfiguration(ISendPipeSpecification parentSpecification)
 {
     _specification = new SendPipeSpecification();
     _specification.ConnectSendPipeSpecificationObserver(new ParentSendPipeSpecificationObserver(parentSpecification));
 }
コード例 #5
0
 public SendPipeConfiguration(ISendTopology sendTopology)
 {
     _specification = new SendPipeSpecification();
     _specification.ConnectSendPipeSpecificationObserver(new TopologySendPipeSpecificationObserver(sendTopology));
 }