public async Task Handle(NotificationEnvelope notify, CancellationToken cancellationToken) { switch (notify.Event) { case ProjectCreated projectCreated: _logger.LogInformation("[NCK] Start to publish ProjectCreatedMsg."); await _dispatchedEventBus.PublishAsync( projectCreated.MapTo <ProjectCreated, ProjectCreatedMsg>(), "project-created"); break; case TaskCreated taskCreated: _logger.LogInformation("[NCK] Start to publish TaskCreatedMsg."); await _dispatchedEventBus.PublishAsync( taskCreated.MapTo <TaskCreated, TaskCreatedMsg>(), "task-created"); break; } }