示例#1
0
        public IMessagingChannel CreateConnection(
            ServiceBusConnector connector,
            ServiceBusChannelGroupConfiguration config)
        {
            SubscriptionClient subscriptionClient = null;

            if (!config.DispatchOnly)
            {
                subscriptionClient = SubscriptionClient.CreateFromConnectionString(
                    _connectionString, config.InputHubPath, "allmessages");
            }

            var topicClient = TopicClient.CreateFromConnectionString(_connectionString, config.InputHubPath);

            return(new AzureTopicChannel(connector, config, topicClient, subscriptionClient, CancellationToken.None));
        }
示例#2
0
        public AzureTopicChannel(
            ServiceBusConnector connector,
            ServiceBusChannelGroupConfiguration configuration,
            TopicClient topicClient,
            SubscriptionClient subscriptionClient,
            CancellationToken shutdownToken)
        {
            _connector          = connector;
            _configuration      = configuration;
            _topicClient        = topicClient;
            _subscriptionClient = subscriptionClient;
            _masterShutdownTokenRegistration = shutdownToken
                                               .Register(() => _shutdownToken.Cancel());
            _identifier = Interlocked.Increment(ref _nextIdentifier);

            CurrentResolver    = configuration.DependencyResolver;
            CurrentTransaction = null;
        }