public BusBuilder Configure(BusBuilder builder)
		{
			builder.Match<ServiceBusBuilder>(x =>
				{
					var settings = new ServiceBusSettings(builder.Settings);

					settings.InputAddress = _uri ?? builder.Settings.InputAddress.AppendToPath("_control");

					// the endpoint factory is already created, so we can't set the endpoint here
					// we really need this to be part of another step, but i don't have a clue how yet.
					//_configurator.ConfigureEndpoint(_uri, x => x.PurgeExistingMessages());

					if (_log.IsDebugEnabled)
						_log.DebugFormat("Configuring control bus for {0} at {1}", builder.Settings.InputAddress, settings.InputAddress);

					settings.ConcurrentConsumerLimit = 1;
					settings.ConcurrentReceiverLimit = 1;
					settings.AutoStart = true;

					BusBuilder controlBusBuilder = new ControlBusBuilderImpl(settings);

					controlBusBuilder = _configurators
						.Aggregate(controlBusBuilder, (current, configurator) => configurator.Configure(current));

					IControlBus controlBus = controlBusBuilder.Build();

					x.UseControlBus(controlBus);
				});

			return builder;
		}
        public BusBuilder Configure(BusBuilder builder)
        {
            builder.Match <ServiceBusBuilder>(x =>
            {
                var settings = new ServiceBusSettings(builder.Settings);

                settings.InputAddress = _uri ?? builder.Settings.InputAddress.AppendToPath("_control");

                // the endpoint factory is already created, so we can't set the endpoint here
                // we really need this to be part of another step, but i don't have a clue how yet.
                //_configurator.ConfigureEndpoint(_uri, x => x.PurgeExistingMessages());

                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Configuring control bus for {0} at {1}", builder.Settings.InputAddress, settings.InputAddress);
                }

                settings.ConcurrentConsumerLimit = 1;
                settings.ConcurrentReceiverLimit = 1;
                settings.AutoStart = true;

                BusBuilder controlBusBuilder = new ControlBusBuilderImpl(settings);

                controlBusBuilder = _configurators
                                    .Aggregate(controlBusBuilder, (current, configurator) => configurator.Configure(current));

                IControlBus controlBus = controlBusBuilder.Build();

                x.UseControlBus(controlBus);
            });

            return(builder);
        }
		public SubscriptionObserver Create(IServiceBus bus, SubscriptionRouter router)
		{
			string path = bus.ControlBus.Endpoint.Address.Uri.AbsolutePath;

			Uri uri = new UriBuilder("msmq-pgm", _multicastAddress.Address.ToString(), _multicastAddress.Port, path).Uri;
			Uri clientUri = uri.AppendToPath("_subscriptions");

			var builder = new ControlBusBuilderImpl(new ServiceBusSettings
				{
					ConcurrentConsumerLimit = 1,
					ConcurrentReceiverLimit = 1,
					EndpointCache = bus.EndpointCache,
					InputAddress = clientUri,
					ReceiveTimeout = 3.Seconds(),
					Network = router.Network,
					AutoStart = true,
				});

            _subscriptionBus = builder.Build();

            var service = new MulticastSubscriptionClient(_subscriptionBus, router, _group ?? router.PeerId.ToString());

			return service;
		}
		public IBusService Create(IServiceBus bus)
		{
			string path = bus.ControlBus.Endpoint.Address.Uri.AbsolutePath;

			Uri uri = new UriBuilder("msmq-pgm", _multicastAddress.Address.ToString(), _multicastAddress.Port, path).Uri;
			Uri clientUri = uri.AppendToPath("_subscriptions");

			var builder = new ControlBusBuilderImpl(new ServiceBusSettings
				{
					ConcurrentConsumerLimit = 1,
					ConcurrentReceiverLimit = 1,
					// REVIEW get rid of this damn thing (what thing, I don't get it, if Dru doesn't than remove this todo)
					AutoStart = true,
					EndpointCache = bus.EndpointCache,
					InputAddress = clientUri,
					ReceiveTimeout = 3.Seconds(),
				});

			IControlBus subscriptionBus = builder.Build();

			var service = new MulticastSubscriptionClient(subscriptionBus, clientUri, _networkKey);

			return service;
		}
        public SubscriptionObserver Create(IServiceBus bus, SubscriptionRouter router)
        {
            string path = bus.ControlBus.Endpoint.Address.Uri.AbsolutePath;

            Uri uri       = new UriBuilder("msmq-pgm", _multicastAddress.Address.ToString(), _multicastAddress.Port, path).Uri;
            Uri clientUri = uri.AppendToPath("_subscriptions");

            var builder = new ControlBusBuilderImpl(new ServiceBusSettings
            {
                ConcurrentConsumerLimit = 1,
                ConcurrentReceiverLimit = 1,
                EndpointCache           = bus.EndpointCache,
                InputAddress            = clientUri,
                ReceiveTimeout          = 3.Seconds(),
                Network   = router.Network,
                AutoStart = true,
            });

            IControlBus subscriptionBus = builder.Build();

            var service = new MulticastSubscriptionClient(subscriptionBus, router);

            return(service);
        }