Beispiel #1
0
        protected override void Configure()
        {
            container = new CompositionContainer(
                new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x))));

            var consumerResolver = new SimpleConsumerContainer();

            connectionFactory = new DefaultConnectionFactory("localhost");
            var bus = new RogerBus(connectionFactory, consumerResolver, exchangeResolver: new StaticExchangeResolver("RabbusChat"));

            var batch = new CompositionBatch();

            batch.AddExportedValue <IWindowManager>(new WindowManager());
            batch.AddExportedValue <IEventAggregator>(new EventAggregator());
            batch.AddExportedValue(container);
            batch.AddExportedValue <IRabbitBus>(bus);

            container.Compose(batch);

            consumerResolver.Register(container.GetExportedValue <ShellViewModel>());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var connectionFactory = new DefaultConnectionFactory("localhost");

            using (var connection = connectionFactory.CreateConnection())
            {
                var model = connection.CreateModel();

                model.ExchangeDeclare("RabbusChat", ExchangeType.Topic, false);
            }

            var consumerContainer = new SimpleConsumerContainer();

            var bus  = new RogerBus(connectionFactory, consumerContainer, exchangeResolver: new StaticExchangeResolver("RabbusChat"));
            var chat = new ChatServer(bus);

            consumerContainer.Register(chat);

            bus.Start();

            Console.ReadLine();

            bus.Dispose();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var connectionFactory = new DefaultConnectionFactory("localhost");

            using(var connection = connectionFactory.CreateConnection())
            {
                var model = connection.CreateModel();

                model.ExchangeDeclare("RabbusChat", ExchangeType.Topic, false);
            }

            var consumerContainer = new SimpleConsumerContainer();

            var bus = new RogerBus(connectionFactory, consumerContainer, exchangeResolver: new StaticExchangeResolver("RabbusChat"));
            var chat = new ChatServer(bus);

            consumerContainer.Register(chat);

            bus.Start();

            Console.ReadLine();

            bus.Dispose();
        }
Beispiel #4
0
 protected void RegisterOnDefaultBus(IConsumer consumer)
 {
     consumerContainer.Register(consumer);
 }
Beispiel #5
0
 protected void RegisterOnSecondaryBus(IConsumer consumer)
 {
     secondaryConsumerContainer.Register(consumer);
 }