private void PrepareRequestFillSenders(NotifyRequest request, IServiceScope serviceScope) { if (request.SenderNames == null) { var subscriptionProvider = request.GetSubscriptionProvider(serviceScope); var senderNames = new List <string>(); senderNames.AddRange(subscriptionProvider.GetSubscriptionMethod(request.NotifyAction, request.Recipient) ?? new string[0]); senderNames.AddRange(request.Arguments.OfType <AdditionalSenderTag>().Select(tag => (string)tag.Value)); request.SenderNames = senderNames.ToArray(); } }
private void SendGroupNotify(NotifyRequest request, List <SendResponse> responces, IServiceScope serviceScope) { if (request.Recipient is IDirectRecipient) { var subscriptionSource = request.GetSubscriptionProvider(serviceScope); if (!request.IsNeedCheckSubscriptions || !subscriptionSource.IsUnsubscribe(request.Recipient as IDirectRecipient, request.NotifyAction, request.ObjectID)) { var directresponses = new List <SendResponse>(1); try { directresponses = SendDirectNotify(request, serviceScope); } catch (Exception exc) { directresponses.Add(new SendResponse(request.NotifyAction, request.Recipient, exc)); } responces.AddRange(directresponses); } } else { if (request.Recipient is IRecipientsGroup) { var checkresp = CheckPreventInterceptors(request, InterceptorPlace.GroupSend, serviceScope, null); if (checkresp != null) { responces.Add(checkresp); } else { var recipientProvider = request.GetRecipientsProvider(serviceScope); try { var recipients = recipientProvider.GetGroupEntries(request.Recipient as IRecipientsGroup) ?? new IRecipient[0]; foreach (var recipient in recipients) { try { var newRequest = request.Split(recipient); SendGroupNotify(newRequest, responces, serviceScope); } catch (Exception exc) { responces.Add(new SendResponse(request.NotifyAction, request.Recipient, exc)); } } } catch (Exception exc) { responces.Add(new SendResponse(request.NotifyAction, request.Recipient, exc) { Result = SendResult.IncorrectRecipient }); } } } else { responces.Add(new SendResponse(request.NotifyAction, request.Recipient, null) { Result = SendResult.IncorrectRecipient, Exception = new NotifyException("recipient may be IRecipientsGroup or IDirectRecipient") }); } } }