Ejemplo n.º 1
0
        /// <inheritdoc cref="IServicebus.PublishAsync{TEvent}" />
        public async Task PublishAsync <TEvent>(TEvent domainEvent) where TEvent : class, new()
        {
            var serviceName = _config.CurrentValue.ServiceName;
            var metadata    = new MessageMetadata <TEvent>(serviceName, domainEvent);
            var serialized  = await _serializer.SerializeAsync(metadata).ConfigureAwait(false);

            _logger.LogInformation("Dispatching {EventName} {RequestId}", typeof(TEvent).FullName, metadata.Identifier);
            await _transport.SendMessageAsync <TEvent>(serialized).ConfigureAwait(false);
        }