AzureServiceBusEndpointAddressImpl([NotNull] Data data,
			AddressType addressType)
		{
			if (data == null)
				throw new ArgumentNullException("data");

			_data = data;

			_tp = TokenProvider.CreateSharedSecretTokenProvider(_data.UsernameIssuer,
			                                                    _data.PasswordSharedSecret);

			var sbUri = ServiceBusEnvironment.CreateServiceUri("sb", _data.Namespace, string.Empty);

			var mfs = new MessagingFactorySettings
				{
					TokenProvider = _tp,
					NetMessagingTransportSettings =
						{
							// todo: configuration setting
							BatchFlushInterval = 50.Milliseconds()
						},
					OperationTimeout = 3.Seconds()
				};
			_mff = () => MessagingFactory.Create(sbUri, mfs);

			_nm = new NamespaceManager(sbUri, _tp);

			string suffix = "";
			if (addressType == AddressType.Queue)
				_queueDescription = new QueueDescriptionImpl(data.QueueOrTopicName);
			else
			{
				_topicDescription = new TopicDescriptionImpl(data.QueueOrTopicName);
				suffix = "?topic=true";
			}

			_rebuiltUri = new Uri(string.Format("azure-sb://{0}:{1}@{2}/{3}{4}", 
				data.UsernameIssuer,
				data.PasswordSharedSecret,
				data.Namespace,
				data.QueueOrTopicName,
				suffix));

			_friendlyUri = new Uri(string.Format("azure-sb://{0}/{1}{2}",
				data.Namespace,
				data.QueueOrTopicName,
				suffix));
		}
		public void SignalUnboundSubscription(Guid key, TopicDescription value)
		{
			lock (_subscribed)
				if (_subscribed.Has(key))
					_subscribed.Remove(key);
		}
		public void SignalBoundSubscription(Guid key, TopicDescription value)
		{
			lock (_subscribed)
				if (!_subscribed.Has(key))
					_subscribed.Add(key, value);
		}