예제 #1
0
        public PubsubPublisher(PubsubOptions options)
        {
            _options          = options;
            _serviceApiClient = options.ServiceApiClient;
            _publishers       = new Dictionary <string, PublisherClient>();

            LoadTopics();
        }
예제 #2
0
        public PubsubSubscriber(PubsubOptions options, string topic)
        {
            _running = false;

            _topic          = topic;
            _subscriptionId = _topic;
            _options        = options;

            _subscriberService = SubscriberServiceApiClient.Create();
            _serviceApiClient  = PublisherServiceApiClient.Create();

            var subscriptionName = new SubscriptionName(options.ProjectId, _subscriptionId);

            _subscriber = SubscriberClient.Create(subscriptionName, new[] { _subscriberService },
                                                  new SubscriberClient.Settings()
            {
                FlowControlSettings = new Google.Api.Gax
                                      .FlowControlSettings(
                    maxOutstandingElementCount: _options.MaxOutstandingElementCount,
                    maxOutstandingByteCount: _options.MaxOutstandingByteCount)
            });
        }