示例#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;
        }
示例#2
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);
        }