Esempio n. 1
0
 public MessageBusHub(IMessageSubscriber subscriber) {
     subscriber.Subscribe<EntityChanged>(OnEntityChanged);
     subscriber.Subscribe<EventOccurrence>(OnEventOccurrence);
     subscriber.Subscribe<PlanChanged>(OnPlanChanged);
     subscriber.Subscribe<PlanOverage>(OnPlanOverage);
     subscriber.Subscribe<StackUpdated>(OnStackUpdated);
 }
 public PollChannel(IMessageSubscriber messageSubscriber, string channel, string @group)
 {
     this.messageSubscriber = messageSubscriber;
     messageSubscriber.AddListener(this);
     this.channel = channel;
     this.group = group;
 }
 public BuildsController(IDocumentStore store, IBuildRepository buildRepository, ProcedureExecutor procedureExecutor, IMessageSubscriber messageSubscriber)
 {
     this.store = store;
     this.buildRepository = buildRepository;
     this.procedureExecutor = procedureExecutor;
     this.messageSubscriber = messageSubscriber;
 }
Esempio n. 4
0
 internal SubscriberInfo(IMessageSubscriber Subscriber)
 {
     SubscriberType = Subscriber.GetType();
     Instance = Subscriber;
     Roles = new RoleSet(SubscriberType);
     _ObservedSet = new UniqueSet<IMessageSubscriber>();
 }
Esempio n. 5
0
 public void Verify(string revision, IMessageSubscriber subscriber)
 {
     this.revision = revision;
     var revisionHashLength = "280bb4850c149a0a33412093cba5d22b4d10bff4".Length;
     if (revision.Length == revisionHashLength && Regex.Match(revision, "[0-9a-fA-F]*").Success)
     {
         subscriber.Published(string.Format("Revision number is a valid Git hash."));
         subscriber.Ask("Pull this revision? (Y/N)", this);
     }
 }
Esempio n. 6
0
        private Message(Type _Origin, Type _TargetRole, object _EventType, IMessageSubscriber _Instance, object _Payload)
        {
            Origin = _Origin;
            SenderInstance = _Instance;
            EventType = _EventType;
            TargetRole = _TargetRole;
            Payload = _Payload;
            TargetInstance = null;

            AssertValid(_TargetRole);
            AssertValid(_Instance, _Origin);
        }
Esempio n. 7
0
 public DllDebugger(IMessageSubscriber subscriber, ISourceRepository sourceRepository)
 {
     this.subscriber = subscriber;
     this.sourceRepository = sourceRepository;
     NumberOfModulesLoaded = 0;
 }
 public MessagePublisher(IMessageSubscriber messageSubscriber)
 {
     _messageSubscriber = messageSubscriber;
 }
Esempio n. 9
0
 /// <summary>
 /// Identifies sender both as type and as a specific instance.  Useful for an observed type
 /// like a model.
 /// </summary>
 /// <param name="_Origin">Sender type, for grouping.</param>
 /// <param name="_TargetRole">Role that member instances must implement to receive message.</param>
 /// <param name="_EventType">The event type or function number.</param>
 /// <param name="_Instance">The source instance (of type _Origin)</param>
 public Message(Type _Origin, Type _TargetRole, object _EventType, IMessageSubscriber _Instance)
     : this(_Origin, _TargetRole, _EventType, _Instance, null)
 {
 }
Esempio n. 10
0
 public Message(IMessageSubscriber _OriginInstance, Type _TargetRole, object _EventType, object _Payload)
     : this(_OriginInstance.GetType(), _TargetRole, _EventType, _OriginInstance, _Payload)
 {
 }
Esempio n. 11
0
 private void AssertValid(IMessageSubscriber _Instance, Type _Origin)
 {
     if ( _Instance != null && (_Instance.GetType() != _Origin && ! _Instance.GetType().IsSubclassOf(_Origin) )) {
         throw new ArgumentException("Sending instance expected to be of type " + _Origin.Name);
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Where the destination's instance is known, this can be used to short circuit the
 /// message send addressing scheme.
 /// It allows a call to go down a hierarchy: e.g. Controller -> Renderer -> Palette
 /// It allows a response to a received message.
 /// </summary>
 /// <param name="Target">The instance to exclusively receive this message.</param>
 public void SetTargetInstance(IMessageSubscriber Target)
 {
     TargetInstance = Target;
 }
 public SampleService(ILogger logger, IMessageSubscriber sampleMessageSubscriber)
 {
     _logger = logger;
     _sampleMessageSubscriber = sampleMessageSubscriber;
 }
Esempio n. 14
0
 public MessageBusBroker(IConnectionManager connectionManager, IConnectionMapping connectionMapping, IMessageSubscriber subscriber) {
     _connectionManager = connectionManager;
     _connectionMapping = connectionMapping;
     _subscriber = subscriber;
 }
Esempio n. 15
0
 /// <summary>
 /// Removes the observed-object from the observer if and only if
 /// the given object was the observed object.
 /// </summary>
 /// <param name="ClearIfObserved">The object to cease observing</param>
 /// <returns>True if the given object was being observed by THIS object.</returns>
 public bool ClearObservedObject(IMessageSubscriber ClearIfObserved)
 {
     return _ObservedSet.Has( ClearIfObserved, () =>
     {
         _ObservedSet.Remove( ClearIfObserved );
     });
 }
Esempio n. 16
0
 public void SetObservedObject(IMessageSubscriber ObservedObject)
 {
     _ObservedSet.Add(ObservedObject);
 }
 public static void SendVia(Message msg, MessageBus MsgBus, IMessageSubscriber Caller)
 {
     msg.ActualSender = Caller;
     MsgBus.Send(msg);
 }
 public MessageBusBroker(IConnectionManager connectionManager, ConnectionMapping userIdConnections, IMessageSubscriber subscriber) {
     _connectionManager = connectionManager;
     _userIdConnections = userIdConnections;
     _subscriber = subscriber;
 }
Esempio n. 19
0
 public void AnsweredWith(string response, IMessageSubscriber subscriber)
 {
     if (responseParser.Yes(response))
         subscriber.Published(string.Format("Pulling source corresponding to {0}", revision));
     else subscriber.Published(string.Format("Skipping revision {0}", revision));
 }