コード例 #1
0
        private void RaiseRequestPartyCommentReceived(RfqComment comment)
        {
            Logger.InfoFormat("Request party comment received: {0}", comment);

            var handler = RequestPartyCommentReceived;

            if (handler != null)
            {
                handler(this, new Event <RfqComment>(comment));
            }
        }
コード例 #2
0
 private static void PopulateComment(IContextBuilder cb, RfqComment comment)
 {
     if (comment.RequestId != null)
     {
         cb.AddValue("requestId", comment.RequestId);
     }
     cb.AddValue("requestParty", comment.RequestParty);
     cb.AddValue("counterParty", comment.CounterParty);
     if (comment.ProductName != null)
     {
         cb.AddValue("productName", comment.ProductName);
     }
     cb.AddValue("comment", comment.Comment);
 }
コード例 #3
0
 // ctr [email protected] to [email protected] re @1 Nope
 // ctr [email protected] to [email protected] Nope
 public static string ToCounterToRequestPartyCommentMessage(this RfqComment comment)
 {
     if (string.IsNullOrEmpty(comment.RequestId))
     {
         return(string.Format("ctr {0} to {1} {2}",
                              comment.CounterParty,
                              comment.RequestParty,
                              comment.Comment));
     }
     return(string.Format("ctr {0} to {1} wrt @{2} {3}",
                          comment.CounterParty,
                          comment.RequestParty,
                          comment.RequestId,
                          comment.Comment));
 }
コード例 #4
0
        public void SendCommentToRequestParty(RfqComment comment)
        {
            Logger.InfoFormat("Sending comment {0}", comment);

            lock (mx_)
            {
                if (!requestToCounterPartyCommentSubscriptions_.Contains(comment.RequestParty))
                {
                    // TODO: log we're ignoring
                    return;
                }
            }

            RaiseCounterPartyCommentReceived(comment);
        }
コード例 #5
0
 private void PushComment(
     RfqComment comment,
     Func <RfqComment, string> partyGetter,
     Dictionary <string, HashSet <IEventStreamSubscriber> > subscriptions)
 {
     lock (mx_)
     {
         HashSet <IEventStreamSubscriber> subscribers;
         if (subscriptions.TryGetValue(
                 partyGetter(comment),
                 out subscribers))
         {
             foreach (var subscriber in subscribers)
             {
                 subscriber.Push(cb => PopulateComment(cb, comment));
             }
         }
     }
 }
コード例 #6
0
        public void SendCommentToRequestParty(RfqComment comment)
        {
            Logger.InfoFormat("Sending comment {0}", comment);

            SendMessage(comment.RequestParty, comment.ToCounterToRequestPartyCommentMessage());
        }