public function enableAutoImportMessageHandlers(array $directories, array $excludedFiles = []): self
    {
        $this->importParameters([
            'service_bus.auto_import.handlers_enabled'     => true,
            'service_bus.auto_import.handlers_directories' => $directories,
            'service_bus.auto_import.handlers_excluded'    => $excludedFiles,
        ]);

        $this->containerBuilder->addCompilerPasses(new ImportMessageHandlersCompilerPass());

        return $this;
    }
public function enableAutoImportMessageHandlers(array $directories, array $excludedFiles = []): self
    {
        $this->importParameters([
            'service_bus.auto_import.handlers_enabled'     => true,
            'service_bus.auto_import.handlers_directories' => $directories,
            'service_bus.auto_import.handlers_excluded'    => $excludedFiles,
        ]);

        $this->containerBuilder->addCompilerPasses(new ImportMessageHandlersCompilerPass());

        return $this;
    }
public function enableAutoImportMessageHandlers ( array $ directories , array $ excludedFiles = [ ] ) : self { $ this -> importParameters ( [ 'service_bus.auto_import.handlers_enabled' => true , 'service_bus.auto_import.handlers_directories' => $ directories , 'service_bus.auto_import.handlers_excluded' => $ excludedFiles , ] ) ; $ this -> containerBuilder -> addCompilerPasses ( new ImportMessageHandlersCompilerPass ( ) ) ; return $ this ; }
All message handlers from the specified directories will be registered automatically.

Note: All files containing user-defined functions must be excluded
Note: Increases start time because of the need to scan files

@param array<int, string> $directories
@param array<int, string> $excludedFiles

@return self
All message handlers from the specified directories will be registered automatically .