Example #1
0
        public SubscriptionClient(INamespaceManager <T> namespaceManager,
                                  ISerializationProvider serializationProvider,
                                  ILogger <ClientBase <T> > logger)
            : base(serializationProvider, logger)
        {
            if (namespaceManager == null)
            {
                throw new ArgumentNullException(nameof(namespaceManager));
            }

            _client = new AwaitableLazy <AzureClient>(async() =>
            {
                await namespaceManager.ProvisionSubscriptionAsync();
                return(namespaceManager.CreateSubscriptionClient());
            });
        }
Example #2
0
        public TopicClient(INamespaceManager <T> namespaceManager,
                           ISerializationProvider serializationProvider,
                           ILogger <ClientBase <T> > logger,
                           IEnumerable <IMessageExtension <T> > extensions)
            : base(serializationProvider, logger)
        {
            if (namespaceManager == null)
            {
                throw new ArgumentNullException(nameof(namespaceManager));
            }

            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            _extensions = extensions.ToArray();
            _client     = new AwaitableLazy <AzureClient>(async() =>
            {
                await namespaceManager.ProvisionTopicAsync();
                return(namespaceManager.CreateTopicClient());
            });
        }