예제 #1
0
        public PublisherClientImpl(Publisher.IPublisherClient grpcClient, PublisherSettings settings)
        {
            this.GrpcClient = grpcClient;
            PublisherSettings effectiveSettings = settings ?? PublisherSettings.GetDefault();

            _clientHelper = new ClientHelper(effectiveSettings);
        }
예제 #2
0
        public PublisherClientImpl(Publisher.IPublisherClient grpcClient, PublisherSettings settings)
        {
            this.GrpcClient = grpcClient;
            PublisherSettings effectiveSettings = settings ?? PublisherSettings.GetDefault();
            IClock            effectiveClock    = effectiveSettings.Clock ?? SystemClock.Instance;

            _clientHelper    = new ClientHelper(effectiveSettings);
            _callCreateTopic = _clientHelper.BuildApiCall <Topic, Topic>(GrpcClient.CreateTopicAsync, GrpcClient.CreateTopic)
                               .WithRetry(effectiveSettings.CreateTopicRetry, effectiveClock, null);
            _callPublish = _clientHelper.BuildApiCall <PublishRequest, PublishResponse>(GrpcClient.PublishAsync, GrpcClient.Publish)
                           .WithRetry(effectiveSettings.PublishRetry, effectiveClock, null);
            _callGetTopic = _clientHelper.BuildApiCall <GetTopicRequest, Topic>(GrpcClient.GetTopicAsync, GrpcClient.GetTopic)
                            .WithRetry(effectiveSettings.GetTopicRetry, effectiveClock, null);
            _callListTopics = _clientHelper.BuildApiCall <ListTopicsRequest, ListTopicsResponse>(GrpcClient.ListTopicsAsync, GrpcClient.ListTopics)
                              .WithRetry(effectiveSettings.ListTopicsRetry, effectiveClock, null);
            _callListTopicSubscriptions = _clientHelper.BuildApiCall <ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse>(GrpcClient.ListTopicSubscriptionsAsync, GrpcClient.ListTopicSubscriptions)
                                          .WithRetry(effectiveSettings.ListTopicSubscriptionsRetry, effectiveClock, null);
            _callDeleteTopic = _clientHelper.BuildApiCall <DeleteTopicRequest, Empty>(GrpcClient.DeleteTopicAsync, GrpcClient.DeleteTopic)
                               .WithRetry(effectiveSettings.DeleteTopicRetry, effectiveClock, null);
        }