public override void Execute() { Logger.Info($"{nameof(FolderMonitorEndpoint)} Checking {folderName}"); var di = new DirectoryInfo(folderName); if (!di.Exists) { throw new ArgumentException($"Folder not found \'{folderName}\'"); } var exchanges = GetDirs(di, recursive) .SelectMany(x => x.EnumerateFiles(searchPattern, SearchOption.TopDirectoryOnly)) .Select(x => CreateMessage(x)) .Select(msg => Ctx.CreateExchange(Route, msg, OnComplete)) .ToList(); exchanges.ForEach(x => { Ctx.Start(x); }); }