private static string FindRoute(IMessageRouteProvider routeProvider, string messageType)
        {
            var routeUris = routeProvider.GetRouteUris(messageType).ToList();

            if (!routeUris.Any())
            {
                throw new SendMessageException(string.Format(EsbResources.MessageRouteNotFound, messageType));
            }

            if (routeUris.Count() > 1)
            {
                throw new SendMessageException(string.Format(EsbResources.MessageRoutedToMoreThanOneEndpoint,
                                                             messageType, string.Join(",", routeUris.ToArray())));
            }

            return(routeUris.ElementAt(0));
        }
        public void Execute(OnStarted pipelineEvent)
        {
            if (!_messageRoutePrvider.GetRouteUris(typeof(RegisterEndpointCommand).FullName).Any())
            {
                Log.For(this).Warning(Resources.WarningSentinelRouteMissing);
                return;
            }

            _thread = new Thread(Send);

            _active = true;
            _thread.Start();

            while (!_thread.IsAlive)
            {
            }
        }