Пример #1
0
 public ProcessedMessageTrack GetTrackFor(ApplicationInfo applicationInfo)
 {
     if (applicationInfo.IsNull())
     {
         throw new ArgumentNullException();
     }
     return(collection.Find(x => x.ProcessingApplication.ApplicationName == applicationInfo.ApplicationName).FirstOrDefault());
 }
Пример #2
0
        public static ProcessedMessageTrack ToMessageTrack(ObjectId eventID, DateTime eventTime, Type messageType, ApplicationInfo application)
        {
            if (eventID.IsNull() || eventTime.IsNull() || messageType.IsNull() || application.IsNull())
            {
                throw new ArgumentNullException();
            }

            return(new ProcessedMessageTrack
            {
                EventID = eventID,
                EventTime = eventTime,
                MessageType = messageType.FullName,
                ProcessingApplication = application
            });
        }
Пример #3
0
        public void Subscribe(Subscriber <t> subscriber, ApplicationInfo listenerApplication)
        {
            if (subscriber.IsNull() || listenerApplication.IsNull())
            {
                throw new ArgumentNullException();
            }

            if (!SupportedMessages.GetInstance().IsTypeSupported(typeof(t)))
            {
                throw new ArgumentException("Type not supported by MessageBus");
            }

            /**Here assumption is that only subscriber will exist one app context for one type of message.
             * if double entry is tried that system will ignore the subscription attempt. It is the
             * responsiblity of the caller to ensure that double subscription doesnt happen
             */

            if (!this.subscribers.ContainsKey(typeof(t).FullName))
            {
                MessageMonitor <t> messageMonitors = new MessageMonitor <t>(subscriber, listenerApplication);
                this.subscribers.Add(typeof(t).FullName, messageMonitors);
            }
        }