public NamespaceManager Create(string potentialConnectionstring) { return NamespaceManagers.GetOrAdd(potentialConnectionstring, s => { var connectionStringParser = new DeterminesBestConnectionStringForAzureServiceBus(config.TransportConnectionString()); var connectionstring = s != RuntimeEnvironment.MachineName && connectionStringParser.IsPotentialServiceBusConnectionString(s) ? s : connectionStringParser.Determine(config.Settings); return NamespaceManager.CreateFromConnectionString(connectionstring); }); }
public MessagingFactory Create(string potentialConnectionString) { var validation = new DeterminesBestConnectionStringForAzureServiceBus(); var connectionstring = validation.IsPotentialServiceBusConnectionString(potentialConnectionString) ? potentialConnectionString : validation.Determine(); MessagingFactory factory; if (!MessagingFactories.TryGetValue(connectionstring, out factory)) { lock (FactoryLock) { if (!MessagingFactories.TryGetValue(connectionstring, out factory)) { factory = MessagingFactory.CreateFromConnectionString(connectionstring); MessagingFactories[connectionstring] = factory; } } } return factory; }