/// <summary>
        /// Send a notification message to all remote instances
        /// </summary>
        /// <param name="msg">the notification message to send</param>
        /// <param name="exclude">if non-null, exclude this cluster id from the notification</param>
        protected void BroadcastNotification(INotificationMessage msg, string exclude = null)
        {
            var remoteinstances = Services.RegistrationStrategy.GetRemoteInstances(Configuration.Clusters, Services.MyClusterId);

            // if there is only one cluster, don't send notifications.
            if (remoteinstances.Count() == 0)
            {
                return;
            }

            // create notification tracker if we haven't already
            if (notificationTracker == null)
            {
                notificationTracker = new NotificationTracker(this.Services, remoteinstances, max_notification_batch_size, Host);
            }

            notificationTracker.BroadcastNotification(msg, exclude);
        }
Пример #2
0
 /// <summary>
 /// Initialize a new instance of NotificationWorker class
 /// </summary>
 public NotificationWorker(NotificationTracker tracker, string clusterId)
 {
     this.tracker   = tracker;
     this.clusterId = clusterId;
 }