Ejemplo n.º 1
0
        public void And_accept_messages_from_there()
        {
            host.Start();

            using (var bus = applicationContext.Get <IStartableServiceBus>())
            {
                bus.Start();

                using (bus.AddInstanceSubscription(this))
                {
                    bus.Send(new Uri("msmq://localhost/test_queue").ToEndpoint(), new StringMsg
                    {
                        Value = "hello"
                    });

                    Assert.True(resetEvent.WaitOne(TimeSpan.FromSeconds(10), false));

                    Assert.Equal("olleh", reply);
                }
            }
        }
Ejemplo n.º 2
0
        public void RegisterBus()
        {
            var busConfig = (RhinoServiceBusConfiguration)config;

            applicationContext.RegisterSingleton <IStartableServiceBus>(() => new DefaultServiceBus(applicationContext.Get <IServiceLocator>(),
                                                                                                    applicationContext.Get <ITransport>(),
                                                                                                    applicationContext.Get <ISubscriptionStorage>(),
                                                                                                    applicationContext.Get <IReflection>(),
                                                                                                    applicationContext.GetAll <IMessageModule>().ToArray(),
                                                                                                    busConfig.MessageOwners.ToArray(),
                                                                                                    applicationContext.Get <IEndpointRouter>()));

            applicationContext.RegisterSingleton(() => new CreateQueuesAction(applicationContext.Get <IQueueStrategy>(), applicationContext.Get <IServiceBus>()));
        }
Ejemplo n.º 3
0
 public override T GetInstance <T>()
 {
     return(applicationContext.Get <T>());
 }
Ejemplo n.º 4
0
        public void RegisterDefaultServices(IEnumerable <Assembly> assemblies)
        {
            applicationContext.RegisterSingleton <IServiceLocator>(() => new SpringServiceLocator(applicationContext));
            foreach (var assembly in assemblies)
            {
                applicationContext.RegisterSingletons <IBusConfigurationAware>(assembly);
            }

            var locator = applicationContext.Get <IServiceLocator>();

            foreach (var busConfigurationAware in applicationContext.GetAll <IBusConfigurationAware>())
            {
                busConfigurationAware.Configure(config, this, locator);
            }

            foreach (var module in config.MessageModules)
            {
                applicationContext.RegisterSingleton(module, module.FullName);
            }

            applicationContext.RegisterSingleton <IReflection>(() => new SpringReflection());
            applicationContext.RegisterSingleton(config.SerializerType);
            applicationContext.RegisterSingleton <IEndpointRouter>(() => new EndpointRouter());
        }
Ejemplo n.º 5
0
 public T Resolve <T>()
 {
     return(applicationContext.Get <T>());
 }