コード例 #1
0
        protected async Task Act()
        {
            _sampleHandler = new SampleHandler();
            var publisher = CreateMeABus.WithLogging(new LoggerFactory())
                            .InRegion(region)
                            .WithSnsMessagePublisher <GenericMessage>();

            var bus = CreateMeABus.WithLogging(new LoggerFactory())
                      .InRegion(region)
                      .WithMonitoring(Substitute.For <IMessageMonitor>())
                      .WithMessageLockStoreOf(new MessageLockStore())
                      .WithSqsTopicSubscriber()
                      .IntoQueue(QueueName)
                      .ConfigureSubscriptionWith(cfg =>
            {
                cfg.MessageRetentionSeconds = 60;
            }).WithMessageHandler(_sampleHandler);

            publisher.StartListening();
            bus.StartListening();

            await publisher.PublishAsync(_message);

            await publisher.PublishAsync(_message);
        }
コード例 #2
0
        protected void Act()
        {
            _handler1 = new SampleHandler();
            _handler2 = new AnotherSampleHandler();
            var publisher = CreateMeABus.InRegion(region)
                            .ConfigurePublisherWith(_ => { })
                            .WithSnsMessagePublisher <GenericMessage>();

            var bus = CreateMeABus.InRegion(region)
                      .WithMonitoring(new Monitoring())
                      .WithMessageLockStoreOf(new MessageLockStore())
                      .WithSqsTopicSubscriber().IntoQueue(QueueName)
                      .WithMessageHandler(_handler1)
                      .WithMessageHandler(_handler2);

            publisher.StartListening();
            bus.StartListening();

            publisher.Publish(_message);
        }
コード例 #3
0
        protected async Task Act()
        {
            _handler1 = new SampleHandler();
            _handler2 = new AnotherSampleHandler();
            var publisher = CreateMeABus.WithLogging(new LoggerFactory())
                            .InRegion(region)
                            .ConfigurePublisherWith(_ => { })
                            .WithSnsMessagePublisher <GenericMessage>();

            var bus = CreateMeABus.WithLogging(new LoggerFactory())
                      .InRegion(region)
                      .WithMonitoring(Substitute.For <IMessageMonitor>())
                      .WithMessageLockStoreOf(new MessageLockStore())
                      .WithSqsTopicSubscriber().IntoQueue(QueueName)
                      .WithMessageHandlers(_handler1, _handler2);

            publisher.StartListening();
            bus.StartListening();

            await publisher.PublishAsync(_message);
        }
コード例 #4
0
        protected void Act()
        {
            _sampleHandler = new SampleHandler();
            var publisher = CreateMeABus.InRegion(region)
                            .WithSnsMessagePublisher <GenericMessage>();

            var bus = CreateMeABus.InRegion(region)
                      .WithMonitoring(new Monitoring())
                      .WithMessageLockStoreOf(new MessageLockStore())
                      .WithSqsTopicSubscriber()
                      .IntoQueue(QueueName)
                      .ConfigureSubscriptionWith(cfg =>
            {
                cfg.MessageRetentionSeconds = 60;
            }).WithMessageHandler(_sampleHandler);

            publisher.StartListening();
            bus.StartListening();

            publisher.Publish(_message);
            publisher.Publish(_message);
        }