Пример #1
0
        /// <inheritdoc/>
        public async Task PushToConsumer(CloudEventEnvelope cloudEventEnvelope)
        {
            PushQueueReceipt receipt = await _queue.PushToOutboundQueue(JsonSerializer.Serialize(cloudEventEnvelope));

            string cloudEventId   = cloudEventEnvelope.CloudEvent.Id;
            int    subscriptionId = cloudEventEnvelope.SubscriptionId;

            if (!receipt.Success)
            {
                _logger.LogError("// EventsService // StoreCloudEvent // Failed to push event envelope {EventId} to queue. Exception {Exception}", cloudEventId, subscriptionId, receipt.Exception);
            }
        }
Пример #2
0
        /// <inheritdoc/>
        public async Task <string> StoreCloudEvent(CloudEvent cloudEvent)
        {
            cloudEvent.Id   = Guid.NewGuid().ToString();
            cloudEvent.Time = null;
            string cloudEventId = await _repository.Create(cloudEvent);

            PushQueueReceipt receipt = await _queue.PushToQueue(JsonSerializer.Serialize(cloudEvent));

            if (!receipt.Success)
            {
                _logger.LogError("// EventsService // StoreCloudEvent // Failed to push event {EventId} to queue. Exception {Exception}", cloudEventId, receipt.Exception);
            }

            return(cloudEventId);
        }