public override void Start(string name)
        {
            if (_bus != null)
                throw new Exception("Bus already started");

            _logger.Info("Starting service bus, enpoint name " + name);
            _logger.Info("Service bus type: msmq");

            _bus = ServiceBusFactory.New(sbc =>
            {
                sbc.UseNLog();
                sbc.UseJsonSerializer();

                sbc.UseMsmq(c =>
                {
                    c.VerifyMsmqConfiguration();
                    c.UseMulticastSubscriptionClient();
                });

                sbc.Subscribe(c =>
                {
                    if (BusHasHandlers)
                    {
                        c.Handler<DomainUpdateBusMessage>(HandleDomainUpdate);
                    }
                });

                sbc.ReceiveFrom(ConfigurationManager.AppSettings["msmq:host"] + name);
            });
        }
        public override void Start(string name)
        {
            if (_bus != null)
                throw new Exception("Bus already started");

            _logger.Info("Starting service bus, enpoint name " + name);
            _logger.Info("Service bus type: azure");

            var credentials = new Credentials(ConfigurationManager.AppSettings["azure:serviceBusIssuerName"],
                ConfigurationManager.AppSettings["azure:serviceBusIssuerKey"], 
                ConfigurationManager.AppSettings["azure:serviceBusNamespace"], 
                name);

            _bus = ServiceBusFactory.New(sbc =>
            {
                sbc.UseNLog();
                sbc.UseJsonSerializer();

                var uri = credentials.BuildUri(name);

                sbc.ReceiveFrom(uri);

                sbc.Subscribe(c =>
                {
                    if (BusHasHandlers)
                    {
                        c.Handler<DomainUpdateBusMessage>(HandleDomainUpdate);
                    }
                });

                sbc.UseAzureServiceBus(x =>
                {
                    x.ConfigureNamespace(uri.Host, h =>
                    {
                        h.SetKeyName(ConfigurationManager.AppSettings["azure:serviceBusIssuerName"]);
                        h.SetKey(ConfigurationManager.AppSettings["azure:serviceBusIssuerKey"]);
                    });
                });
                sbc.UseAzureServiceBusRouting();
            });
        }
        public override void Start(string name)
        {
            if (_bus != null)
                throw new Exception("Bus already started");

            _logger.Info("Starting service bus, enpoint name " + name);
            _logger.Info("Service bus type: rabbit mq");

            _bus = ServiceBusFactory.New(sbc =>
            {
                sbc.UseNLog();
                sbc.UseJsonSerializer();

                sbc.UseRabbitMq();

                sbc.Subscribe(c =>
                {
                    c.Handler<DomainUpdateBusMessage>(HandleDomainUpdate);
                });

                sbc.ReceiveFrom(ConfigurationManager.AppSettings["rabbitmq:host"] + name);
            });
        }
        public void SetupServiceBus(string[] assemblyPaths, CommandDefinition cmdDef, Dictionary<string, object> connectionSettings)
        {
            _subscriptionQueueService = connectionSettings.GetValue("subscriptionQueueService") as string;

            if (_bus == null)
            {
                if (CommandContentFormat == "JSON")
                {
                    if (_subscriptionQueueService.IsValid())
                    {

                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            sbc.UseMsmq(x => x.UseSubscriptionService(_subscriptionQueueService));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseJsonSerializer();
                            sbc.UseControlBus();
                        });
                    }
                    else
                    {
                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            //sbc.UseMsmq(x => x.UseSubscriptionService(subscriptionServiceUriString));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseJsonSerializer();
                            sbc.UseControlBus();
                        });
                    }
                }
                else
                {
                    if (_subscriptionQueueService != string.Empty)
                    {

                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            sbc.UseMsmq(x => x.UseSubscriptionService(_subscriptionQueueService));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseControlBus();
                        });
                    }
                    else
                    {
                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            //sbc.UseMsmq(x => x.UseSubscriptionService(subscriptionServiceUriString));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseControlBus();
                        });
                    }
                }
                Thread.Sleep(TimeSpan.FromSeconds(10));
            }
        }
Exemplo n.º 5
0
        public void SetupServiceBus(string[] assemblyPaths, CommandDefinition cmdDef, Dictionary <string, object> connectionSettings)
        {
            _subscriptionQueueService = connectionSettings.GetValue("subscriptionQueueService") as string;

            if (_bus == null)
            {
                if (CommandContentFormat == "JSON")
                {
                    if (_subscriptionQueueService.IsValid())
                    {
                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            sbc.UseMsmq(x => x.UseSubscriptionService(_subscriptionQueueService));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseJsonSerializer();
                            sbc.UseControlBus();
                        });
                    }
                    else
                    {
                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            //sbc.UseMsmq(x => x.UseSubscriptionService(subscriptionServiceUriString));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseJsonSerializer();
                            sbc.UseControlBus();
                        });
                    }
                }
                else
                {
                    if (_subscriptionQueueService != string.Empty)
                    {
                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            sbc.UseMsmq(x => x.UseSubscriptionService(_subscriptionQueueService));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseControlBus();
                        });
                    }
                    else
                    {
                        _bus = ServiceBusFactory.New(sbc =>
                        {
                            sbc.UseMsmq();
                            //sbc.UseMsmq(x => x.UseSubscriptionService(subscriptionServiceUriString));
                            sbc.ReceiveFrom("msmq://localhost/ServiceBusMQ");
                            sbc.UseControlBus();
                        });
                    }
                }
                Thread.Sleep(TimeSpan.FromSeconds(10));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MTServiceBusAbstractor"/> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="bus">The bus.</param>
 public MTServiceBusAbstractor(IServiceLocator serviceLocator, IServiceBus bus)
 {
     if (serviceLocator == null)
     {
         throw new ArgumentNullException("serviceLocator");
     }
     if (bus == null)
     {
         throw new ArgumentNullException("bus", "The specified NServiceBus bus cannot be null.");
     }
     _serviceLocator = serviceLocator;
     Bus             = bus;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MTWrapServiceBusAbstractor"/> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="bus">The bus.</param>
 public MTWrapServiceBusAbstractor(IServiceLocator serviceLocator, IServiceBus bus)
     : base(serviceLocator, bus)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MTWrapServiceBusAbstractor"/> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="bus">The bus.</param>
 public MTWrapServiceBusAbstractor(IServiceLocator serviceLocator, IServiceBus bus)
     : base(serviceLocator, bus)
 {
 }