/// <summary> /// Starts asynchronous Azure queue multicast relaying of messages for the route, /// and immediately returns control. /// </summary> /// <returns></returns> public bool BeginAsyncMessageForwarding() { this.EndMessageForwarding(); if (this.SourceQueue.Queue == null) { this.LogWarning("Queue \"{0}\" failed to get initialized. Will not be polled.", this.SourceQueue.QueueName); return false; } if (this.DestinationQueues.IsNullOrEmpty()) { this.LogInformation("Destination queues for source queue \"{0}\" are not specified. Source queue will not be polled.", this.SourceQueue.QueueName); return false; } int initializedDestinationQueueCount = this.DestinationQueues.Count(destinationQueue => destinationQueue.Queue != null); this.LogInformation("Initialized {0} of {1} destination queues for source queue \"{2}\".", initializedDestinationQueueCount, this.DestinationQueues.Count, this.SourceQueue.QueueName); lock (this) { this.queueMonitor = this.InstantiateQueueMonitor(); } return true; }
/// <summary> /// Stops route's message relay. /// </summary> public void EndMessageForwarding() { lock (this) { if (this.queueMonitor != null) { queueMonitor.Stop(); this.queueMonitor = null; } } }