public async Task Write()

in processing-pipelines/common/csharp/PubSubEventWriter.cs [36:53]


        public async Task Write(object eventData, HttpContext context)
        {
            PublisherClient publisher = null;

            foreach (var topicId in _topicIds)
            {
                var topicName = new TopicName(_projectId, topicId);
                publisher = await PublisherClient.CreateAsync(topicName);
                var message = JsonConvert.SerializeObject(eventData);
                _logger.LogInformation($"Publishing to topic '{topicId}' with message '{message}'");
                await publisher.PublishAsync(message);
            }

            if (publisher != null)
            {
                await publisher.ShutdownAsync(TimeSpan.FromSeconds(10));
            }
        }