Exemple #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);
                }
            }
        }
Exemple #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>()));
        }
 public override T GetInstance <T>()
 {
     return(applicationContext.Get <T>());
 }
        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());
        }
 public T Resolve <T>()
 {
     return(applicationContext.Get <T>());
 }