Esempio n. 1
0
        public async Task <IPublisher> CreatePublisher(string topicName, Action <long> ackHandler)
        {
            var duplexStream = grpcClient.Publish();
            await duplexStream.RequestStream.WriteAsync(new FastQueueService.WriteRequest {
                TopicName = topicName
            });

            var publisher = new Publisher(duplexStream, ackHandler);

            publisher.StartAckLoop();
            return(publisher);
        }
Esempio n. 2
0
        private async Task <IPublisher> CreatePublisherInternal(string topicName, PublisherOptions options,
                                                                Func <AsyncDuplexStreamingCall <PublishRequest, PublisherAck>, Publisher> publisherFactory)
        {
            var opt          = options ?? new PublisherOptions();
            var duplexStream = grpcClient.Publish();
            await duplexStream.RequestStream.WriteAsync(new FastQueueService.PublishRequest
            {
                Options = new FastQueueService.PublisherOptions
                {
                    TopicName = topicName,
                    ConfirmationIntervalMilliseconds = opt.ConfirmationIntervalMilliseconds
                }
            });

            var publisher = publisherFactory(duplexStream);

            publisher.StartAckLoop();
            return(publisher);
        }