Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public Task <IPublisherMany> CreatePublisherMany(string topicName, Func <long, Task> ackHandler, PublisherOptions options = null)
 {
     return(CreatePublisherManyInternal(topicName, options, ackHandler == null, duplexStream => new PublisherMany(duplexStream, ackHandler)));
 }
Exemplo n.º 3
0
 public Task <IPublisher> CreatePublisher(string topicName, Action <long> ackHandler, PublisherOptions options = null)
 {
     return(CreatePublisherInternal(topicName, options, duplexStream => new Publisher(duplexStream, ackHandler)));
 }
Exemplo n.º 4
0
 public PublisherOptions(PublisherOptions options)
 {
     ConfirmationIntervalMilliseconds = options.ConfirmationIntervalMilliseconds;
 }