/// <summary> /// /// </summary> /// <typeparam name="TEvent"></typeparam> /// <param name="event"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <bool> PublishEventAsync <TEvent>( TEvent @event, CancellationToken cancellationToken = default) { var result = await eventStore.PushAsync(new EventWrapper { Name = subscriptionsManager.GetEventKey <TEvent>(), Message = JsonSerializer.Serialize(@event), }); logger.LogInformation($"Publish event {(result ? "success" : "failed")}"); if (task == null) { DoConsume(); } return(result); }