public virtual async Task PublishAsync(NotificationPublishOptions options) { CheckNotificationName(options.Notification.NotificationName); await _store.InsertNotificationAsync(options.Notification); _userNotificationQueue.Add(options.Notification); }
public virtual async Task PublishAsync(NotificationPublishOptions options) { var notificationInfo = new NotificationInfo { NotificationName = options.NotificationName, EntityType = options.EntityType == null ? null : options.EntityType.AssemblyQualifiedName, EntityId = options.EntityId == null ? null : options.EntityId.ToString(), //TODO: ToString() can be problem for some types, use JSON serialization instead, based on entity's primary key type Severity = options.Severity, UserIds = options.UserIds.IsNullOrEmpty() ? null : options.UserIds.JoinAsString(","), Data = options.Data.ToJsonString() }; await _store.InsertNotificationAsync(notificationInfo); await _backgroundJobManager.EnqueueAsync<NotificationDistributionJob, NotificationDistributionJobArgs>( new NotificationDistributionJobArgs( notificationInfo.Id ) ); }
public virtual async Task PublishAsync(NotificationPublishOptions options) { CheckNotificationName(options.NotificationName); var notificationInfo = new NotificationInfo { NotificationName = options.NotificationName, EntityType = options.EntityType, EntityId = options.EntityId, Severity = options.Severity, UserIds = options.UserIds.IsNullOrEmpty() ? null : options.UserIds.JoinAsString(",") }; await _store.InsertNotificationAsync(notificationInfo); await _backgroundJobManager.EnqueueAsync <NotificationDistributionJob, NotificationDistributionJobArgs>( new NotificationDistributionJobArgs( notificationInfo.Id ) ); }
public virtual async Task PublishAsync(NotificationPublishOptions options) { CheckNotificationName(options.NotificationName); var notificationInfo = new NotificationInfo { NotificationName = options.NotificationName, EntityType = options.EntityType, EntityId = options.EntityId, Severity = options.Severity, UserIds = options.UserIds.IsNullOrEmpty() ? null : options.UserIds.JoinAsString(",") }; await _store.InsertNotificationAsync(notificationInfo); await _backgroundJobManager.EnqueueAsync<NotificationDistributionJob, NotificationDistributionJobArgs>( new NotificationDistributionJobArgs( notificationInfo.Id ) ); }
public virtual async Task PublishAsync(NotificationPublishOptions options) { var notificationInfo = new NotificationInfo { NotificationName = options.NotificationName, EntityTypeName = options.EntityType == null ? null : options.EntityType.FullName, EntityTypeAssemblyQualifiedName = options.EntityType == null ? null : options.EntityType.AssemblyQualifiedName, EntityId = options.EntityId == null ? null : options.EntityId.ToJsonString(), Severity = options.Severity, UserIds = options.UserIds.IsNullOrEmpty() ? null : options.UserIds.JoinAsString(","), Data = options.Data.ToJsonString(), DataTypeName = options.Data.GetType().AssemblyQualifiedName }; await _store.InsertNotificationAsync(notificationInfo); await _backgroundJobManager.EnqueueAsync<NotificationDistributionJob, NotificationDistributionJobArgs>( new NotificationDistributionJobArgs( notificationInfo.Id ) ); }