public void Send(NotificationEvent notificationEvent) { Debug.Assert(notificationEvent != null); //----- //0 - Remplir la pile des événements //1 - Dépiler les événemnts en asynchrone FIFO foreach (string accountId in notificationEvent.AccountIds) { ObtainNotifications(accountId).Add(notificationEvent.Notification); } //2 - gestion globale async des erreurs }
/// <inheritDoc cref="INotificationPlugin.Send" /> public void Send(NotificationEvent notificationEvent) { var redis = redisConnector.GetResource(); Notification notification = notificationEvent.Notification; string guid = notification.Uuid.ToString(); string typedTarget = "type:" + notification.Type + ";target:" + notification.TargetUrl; ITransaction tx = redis.CreateTransaction(); tx.HashSetAsync("notif:" + guid, NotificationToHashEntry(notification)); tx.StringSetAsync(typedTarget + ";uuid", guid); foreach (string accountURI in notificationEvent.AccountIds) { String notifiedAccount = "notifs:" + accountURI; //On publie la notif (the last wins) tx.ListRemoveAsync(notifiedAccount, guid); tx.ListLeftPushAsync(notifiedAccount, guid); tx.ListRemoveAsync(typedTarget, notifiedAccount); tx.ListLeftPushAsync(typedTarget, notifiedAccount); } tx.Execute(); }
public void Send(Notification notification, ISet <string> accountId) { NotificationEvent notificationEvent = new NotificationEvent(notification, accountId); _notificationPlugin.Send(notificationEvent); }