/// <summary> /// Loops through stored sessions, and pushes responses to open channels. /// </summary> /// <param name="response">CancelOrderResponse DTO</param> public static void PushResponse(CancelOrderResponseData response) { IEnumerable <KeyValuePair <string, IOrderPollingClient> > callbackChannels = _clientCallbackStore.Where(cb => ((IContextChannel)cb.Value).State == CommunicationState.Opened); // TODO: Filter so that the response message is sent to the originating client only, rather than a broadcast. for (int i = 0; i < callbackChannels.Count(); i++) { IOrderPollingClient cb = callbackChannels.ElementAt(i).Value; try { cb.BeginCancelOrderResponse(response, _receiveOrderCancelResponseCompleted, cb); } catch (TimeoutException ex) { _log.Error(ex.Message, ex); } catch (CommunicationException ex) { _log.Error(ex.Message, ex); } } }
/// <summary> /// Processes the Order responses from Saga (note: Saga not yet implemented). /// </summary> /// <param name="message"></param> public void Handle(OrderResponse message) { var response = new CancelOrderResponseData() { ConfirmationId = message.ConfirmationId, Status = message.Status, OrderId = message.OrderId }; OrderPollingService.PushResponse(response); }