public TriggeredJob FindTriggeredJob(AdHocJobParams jobParams)
        {
            var jobName = new JobName(jobParams.JobName);

            var possibleJobs = GetAllTriggeredJobs()
                               .Where(tj => MatchesOnClassAndMethod(jobName, tj) || MatchesOnClass(jobName, tj) || MatchesOnMethod(jobName, tj))
                               .ToArray();

            if (possibleJobs.Length == 1)
            {
                return(possibleJobs[0]);
            }

            if (possibleJobs.Length == 0)
            {
                Log.Warn($"A request to run {jobName.FullName} failed because the specified job could not be found - available jobs are {BuildAvailableJobMessages()}");
            }

            if (possibleJobs.Length > 0)
            {
                Log.Warn($"A request to run {jobName.FullName} failed because more than one specified jobs could not be found - available jobs are {BuildAvailableJobMessages()}. Of these {BuildPossibleJobMessages(possibleJobs)} were matched.");
            }

            return(null);
        }
        public void ProcessQueueMessage(
            [QueueTrigger(Constants.AzureQueueNames.AdHocJobQueue)] AdHocJobParams jobParams,
            TraceWriter logger,
            CancellationToken cancellationToken)
        {
            logger.Info($"Received request to process job type {jobParams.JobName}");
            var triggeredJob = FindTriggeredJob(jobParams);;

            if (triggeredJob != null)
            {
                RunJob(triggeredJob, logger, cancellationToken);
            }
        }