protected override void Given()
        {
            var container         = new Container(x => x.AddRegistry(new BlockingHandlerRegistry()));
            var resolutionContext = new HandlerResolutionContext("test");

            var handlerResolver = new StructureMapHandlerResolver(container);
            var handler         = handlerResolver.ResolveHandler <OrderPlaced>(resolutionContext);

            Assert.That(handler, Is.Not.Null);

            // we use the obsolete interface"IHandler<T>" here
#pragma warning disable 618
            var blockingHandler = (BlockingHandler <OrderPlaced>)handler;
            _resolvedHandler = (BlockingOrderProcessor)blockingHandler.Inner;
#pragma warning restore 618

            DoneSignal = _resolvedHandler.DoneSignal.Task;

            Subscriber = CreateMeABus.WithLogging(new LoggerFactory())
                         .InRegion("eu-west-1")
                         .WithSqsTopicSubscriber()
                         .IntoQueue("container-test")
                         .WithMessageHandler <OrderPlaced>(handlerResolver);

            Subscriber.StartListening();
        }
Пример #2
0
        protected override Task Given()
        {
            var container         = new Container(x => x.AddRegistry(new SingleHandlerRegistry()));
            var resolutionContext = new HandlerResolutionContext("test");

            var handlerResolver = new StructureMapHandlerResolver(container);
            var handler         = handlerResolver.ResolveHandler <OrderPlaced>(resolutionContext);

            handler.ShouldNotBeNull();

            _handlerFuture = ((OrderProcessor)handler).Future;
            DoneSignal     = _handlerFuture.DoneSignal;

            var fixture = new JustSayingFixture();

            Subscriber = fixture.Builder()
                         .WithSqsTopicSubscriber()
                         .IntoQueue("container-test")
                         .WithMessageHandler <OrderPlaced>(handlerResolver);

            SubscriberCts = new CancellationTokenSource();
            Subscriber.StartListening(SubscriberCts.Token);

            return(Task.CompletedTask);
        }
        protected override void When()
        {
            var handlerResolver = new StructureMapHandlerResolver(_container);

            CreateMeABus.InRegion("eu-west-1")
            .WithSqsTopicSubscriber()
            .IntoQueue("container-test")
            .WithMessageHandler <OrderPlaced>(handlerResolver);
        }
Пример #4
0
        protected override Task When()
        {
            var handlerResolver = new StructureMapHandlerResolver(new Container());

            CreateMeABus.InRegion("eu-west-1")
            .WithSqsTopicSubscriber()
            .IntoQueue("container-test")
            .WithMessageHandler <OrderPlaced>(handlerResolver);

            return(Task.FromResult(true));
        }
Пример #5
0
        protected override Task When()
        {
            var handlerResolver = new StructureMapHandlerResolver(_container);

            new JustSayingFixture()
            .Builder()
            .WithSqsTopicSubscriber()
            .IntoQueue("container-test")
            .WithMessageHandler <OrderPlaced>(handlerResolver);

            return(Task.FromResult(true));
        }
Пример #6
0
        protected override void When()
        {
            base.When();
            var handlerResolver = new StructureMapHandlerResolver();

            var subscriber = JustSaying.CreateMeABus.InRegion("eu-west-1")
                             .WithSqsTopicSubscriber()
                             .IntoQueue("container-test")
                             .WithMessageHandler <OrderPlaced>(handlerResolver);

            subscriber.StartListening();
        }
Пример #7
0
        protected override void Given()
        {
            var container = new Container(x => x.AddRegistry(new SingleHandlerRegistry()));

            var handlerResolver = new StructureMapHandlerResolver(container);

            _handlerFuture = ((OrderProcessor)handlerResolver.ResolveHandlers <OrderPlaced>().Single()).Future;

            var subscriber = CreateMeABus.InRegion("eu-west-1")
                             .WithSqsTopicSubscriber()
                             .IntoQueue("container-test")
                             .WithMessageHandler <OrderPlaced>(handlerResolver);

            subscriber.StartListening();
        }
Пример #8
0
        protected override Task When()
        {
            var container = new Container((p) => p.For <IHandlerAsync <OrderPlaced> >().Use <OrderPlacedHandler>());

            var handlerResolver = new StructureMapHandlerResolver(container);

            var fixture = new JustSayingFixture();

            fixture.Builder()
            .WithSqsTopicSubscriber()
            .IntoQueue("container-test")
            .WithMessageHandler <OrderPlaced>(handlerResolver);

            return(Task.FromResult(true));
        }
        protected override void Given()
        {
            var container = new Container(x => x.AddRegistry(new SingleHandlerRegistry()));

            var handlerResolver = new StructureMapHandlerResolver(container);
            var handlers        = handlerResolver.ResolveHandlers <OrderPlaced>().ToList();

            Assert.That(handlers.Count, Is.EqualTo(1));

            _handlerFuture = ((OrderProcessor)handlers[0]).Future;
            DoneSignal     = _handlerFuture.DoneSignal;

            Subscriber = CreateMeABus.InRegion("eu-west-1")
                         .WithSqsTopicSubscriber()
                         .IntoQueue("container-test")
                         .WithMessageHandler <OrderPlaced>(handlerResolver);

            Subscriber.StartListening();
        }
        protected override void Given()
        {
            var container         = new Container(x => x.AddRegistry(new SingleHandlerRegistry()));
            var resolutionContext = new HandlerResolutionContext("test");

            var handlerResolver = new StructureMapHandlerResolver(container);
            var handler         = handlerResolver.ResolveHandler <OrderPlaced>(resolutionContext);

            handler.ShouldNotBeNull();

            _handlerFuture = ((OrderProcessor)handler).Future;
            DoneSignal     = _handlerFuture.DoneSignal;

            Subscriber = CreateMeABus.WithLogging(new LoggerFactory())
                         .InRegion("eu-west-1")
                         .WithSqsTopicSubscriber()
                         .IntoQueue("container-test")
                         .WithMessageHandler <OrderPlaced>(handlerResolver);

            Subscriber.StartListening();
        }