private bool requester_OnMessageRequest(IPullRoute route, Message request, out Message response) { DumpHelper.DumpRequesterSendingMessage(_log, request); if (OnPreProcessing != null) { if (!OnPreProcessing(ref request)) { _log.Write(LogType.Warning, string.Format("The pre-processing handler rejected the requesting message (ID: {0}) from going out.", (request != null) ? request.Header.ID.ToString() : "(null)")); response = null; return(false); } } response = null; bool res = false; if (route != null) { PullSenderBase s = GetPullSender(route); if (s != null) { res = s.SendMessage(request, out response); } } else { foreach (PullSenderBase s in _channels) { res = s.SendMessage(request, out response); if (res) { break; } } } if (!res) { return(res); } DumpHelper.DumpRequesterReceivingMessage(_log, response); if (OnPostProcessing != null) { if (!OnPostProcessing(request, ref response)) { _log.Write(LogType.Warning, string.Format("The post-processing handler rejected the responsing message (ID: {0}) from coming in.", (response != null) ? response.Header.ID.ToString() : "(null)")); return(false); } } return(true); }
public void RegisterChannel(PullChannelConfig channel) { PullSenderBase sender = PullHelper.CreatePullSender(channel, _log); _channels.Add(sender); }