private bool receiver_OnMessageReceived(PullReceiverBase receiver, Message request, out Message response) { DumpHelper.DumpResponserReceivingMessage(_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 coming in.", (request != null) ? request.Header.ID.ToString() : "(null)")); response = null; return(false); } } bool res = _responser.ProcessMessage(receiver.Channel, request, out response); DumpHelper.DumpResponserSendingMessage(_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 going out.", (response != null) ? response.Header.ID.ToString() : "(null)")); return(false); } } return(res); }
public void RegisterChannel(PullChannelConfig channel) { PullReceiverBase receiver = PullHelper.CreatePullReceiver(channel, _log); if (receiver == null) { return; } receiver.OnMessageReceived += new PullMessageReceivedHandler(receiver_OnMessageReceived); _channels.Add(receiver); }