public static IMayWantOptionalSettings InRegions(this JustSayingFluentlyDependencies dependencies, IEnumerable <string> regions)
        {
            var config = new MessagingConfig();

            if (dependencies.MessageSubjectProvider != null)
            {
                config.MessageSubjectProvider = dependencies.MessageSubjectProvider;
            }

            if (regions != null)
            {
                foreach (var region in regions)
                {
                    config.Regions.Add(region);
                }
            }

            config.Validate();

            var messageSerializationRegister = new MessageSerializationRegister(config.MessageSubjectProvider);
            var justSayingBus = new JustSayingBus(config, messageSerializationRegister, dependencies.LoggerFactory);

            var awsClientFactoryProxy = new AwsClientFactoryProxy(() => CreateMeABus.DefaultClientFactory());

            var amazonQueueCreator = new AmazonQueueCreator(awsClientFactoryProxy, dependencies.LoggerFactory);
            var bus = new JustSayingFluently(justSayingBus, amazonQueueCreator, awsClientFactoryProxy, dependencies.LoggerFactory);

            bus
            .WithMonitoring(new NullOpMessageMonitor())
            .WithSerializationFactory(new NewtonsoftSerializationFactory());

            return(bus);
        }
Example #2
0
        public static IMayWantOptionalSettings InRegions(params string[] regions)
        {
            var config = new MessagingConfig();
            
            if (regions != null)
            foreach (var region in regions)
            {
                config.Regions.Add(region);
            }

            config.Validate();

            var messageSerialisationRegister = new MessageSerialisationRegister();
            var justSayingBus = new JustSayingBus(config, messageSerialisationRegister);

            var awsClientFactoryProxy = new AwsClientFactoryProxy(() => DefaultClientFactory());
                
            var amazonQueueCreator = new AmazonQueueCreator(awsClientFactoryProxy);
            var bus = new JustSayingFluently(justSayingBus, amazonQueueCreator, awsClientFactoryProxy);

            bus
                .WithMonitoring(new NullOpMessageMonitor())
                .WithSerialisationFactory(new NewtonsoftSerialisationFactory());

            return bus;
        }
Example #3
0
        public static IMayWantOptionalSettings InRegions(params string[] regions)
        {
            var config = new MessagingConfig();

            if (regions != null)
            {
                foreach (var region in regions)
                {
                    config.Regions.Add(region);
                }
            }

            config.Validate();

            var messageSerialisationRegister = new MessageSerialisationRegister();
            var justSayingBus = new JustSayingBus(config, messageSerialisationRegister);

            var amazonQueueCreator = new AmazonQueueCreator();
            var bus = new JustSayingFluently(justSayingBus, amazonQueueCreator);

            bus
            .WithMonitoring(new NullOpMessageMonitor())
            .WithSerialisationFactory(new NewtonsoftSerialisationFactory());

            return(bus);
        }
Example #4
0
        public static IMayWantOptionalSettings InRegion(string region)
        {
            var config = new MessagingConfig {Region = region};

            config.Validate();

            var bus = new JustSayingFluently(new JustSayingBus(config, new MessageSerialisationRegister()), new AmazonQueueCreator());
            bus.WithMonitoring(new NullOpMessageMonitor());
            bus.WithSerialisationFactory(new NewtonsoftSerialisationFactory());

            return bus;
        }
Example #5
0
        public static IMayWantOptionalSettings InRegion(string region)
        {
            var config = new MessagingConfig {
                Region = region
            };

            config.Validate();

            var bus = new JustSayingFluently(new JustSayingBus(config, new MessageSerialisationRegister()), new AmazonQueueCreator());

            bus.WithMonitoring(new NullOpMessageMonitor());
            bus.WithSerialisationFactory(new NewtonsoftSerialisationFactory());

            return(bus);
        }
        /// <summary>
        /// Creates a new instance of <see cref="IMessagingBus"/>.
        /// </summary>
        /// <returns>
        /// The created instance of <see cref="IMessagingBus"/>
        /// </returns>
        public IMessagingBus BuildSubscribers()
        {
            IMessagingConfig config = MessagingConfig.Build();

            config.Validate();

            ILoggerFactory loggerFactory = ServiceResolver.ResolveService <ILoggerFactory>();

            JustSayingBus          bus     = CreateBus(config, loggerFactory);
            IAwsClientFactoryProxy proxy   = CreateFactoryProxy();
            IVerifyAmazonQueues    creator = new AmazonQueueCreator(proxy, loggerFactory);

            SubscriptionBuilder.Configure(bus, ServiceResolver, creator, proxy, loggerFactory);

            return(bus);
        }
        /// <summary>
        /// Creates a new instance of <see cref="IMessagePublisher"/>.
        /// </summary>
        /// <returns>
        /// The created instance of <see cref="IMessagePublisher"/>
        /// </returns>
        public IMessagePublisher BuildPublisher()
        {
            IMessagingConfig config = MessagingConfig.Build();

            config.Validate();

            ILoggerFactory loggerFactory = ServiceResolver.ResolveService <ILoggerFactory>();

            JustSayingBus          bus   = CreateBus(config, loggerFactory);
            IAwsClientFactoryProxy proxy = CreateFactoryProxy();

            if (PublicationsBuilder != null)
            {
                PublicationsBuilder.Configure(bus, proxy, loggerFactory);
            }

            return(bus);
        }
Example #8
0
 public CreateMeABus(MessagingConfig config)
 {
     _config = config;
 }
Example #9
0
 private IMessagingConfig CreateConfig()
 {
     return(MessagingConfig != null?
            MessagingConfig.Build() :
                ServiceResolver.ResolveService <IMessagingConfig>());
 }
Example #10
0
 public CreateMeABus(MessagingConfig config)
 {
     _config = config;
 }