コード例 #1
0
        async Task <ITopologySectionManager> SetupEndpointOrientedTopology(TransportPartsContainer container, string endpointName, SettingsHolder settings)
        {
            container.Register(typeof(SettingsHolder), () => settings);
            settings.SetDefault("NServiceBus.Routing.EndpointName", endpointName);
            settings.Set <Conventions>(new Conventions());

            var extensions = new TransportExtensions <AzureServiceBusTransport>(settings);

            extensions.NamespacePartitioning().AddNamespace("namespaceName", AzureServiceBusConnectionString.Value);

            var endpointOrientedTopology = new EndpointOrientedTopology(container);

            endpointOrientedTopology.Initialize(settings);

            // create the topologySectionManager
            var topologyCreator = (ICreateTopology)container.Resolve(typeof(TopologyCreator));
            var sectionManager  = container.Resolve <ITopologySectionManager>();
            await topologyCreator.Create(sectionManager.DetermineResourcesToCreate(new QueueBindings()));

            container.RegisterSingleton <TopologyOperator>();
            return(sectionManager);
        }