Exemplo n.º 1
0
        public static IBus Connect(DepotSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            settings.Validate();

            var connectionString = settings.ConnectionString;
            var connectionFactory = settings.ConnectionFactoryBuilder();
            var consumerFactory = settings.ConsumerFactoryBuilder();

            var modelFactory = connectionFactory.Create(new Uri(connectionString));
            var messageSerializers = settings.MessageSerializers;

            var bus = new Bus(
                modelFactory,
                consumerFactory,
                new RequesterFactory(),
                new PublisherFactory(messageSerializers),
                new SubscriptionFactory(modelFactory, messageSerializers));

            foreach (var concern in settings.StartupConcerns)
            {
                concern.Run(bus);
            }

            return bus;
        }
Exemplo n.º 2
0
        public static IBus Connect(string connectionString)
        {
            var settings = new DepotSettings
            {
                ConnectionString = connectionString
            };

            return Connect(settings);
        }
Exemplo n.º 3
0
        public static IBus Connect(string connectionString, DepotSettings settings)
        {
            settings.ConnectionString = connectionString;

            return Connect(settings);
        }