public SimpleMessageBusFileTriggerBinding(IOptions <FileSystemOptions> options, ParameterInfo parameter, ILogger logger, ISimpleMessageBusFileProcessorFactory fileProcessorFactory)
 {
     _options              = options;
     _parameter            = parameter;
     _logger               = logger;
     _fileProcessorFactory = fileProcessorFactory;
     _attribute            = parameter.GetCustomAttribute <SimpleMessageBusFileTriggerAttribute>(inherit: false);
     _bindingDataProvider  = BindingDataProvider.FromTemplate(_attribute.Path);
     _bindingContract      = CreateBindingContract();
 }
        public SimpleMessageBusFileListener(IOptions <FileSystemOptions> options, SimpleMessageBusFileTriggerAttribute attribute, ITriggeredFunctionExecutor triggerExecutor, ILogger logger, ISimpleMessageBusFileProcessorFactory fileProcessorFactory)
        {
            _options              = options ?? throw new ArgumentNullException(nameof(options));
            _attribute            = attribute ?? throw new ArgumentNullException(nameof(attribute));
            _triggerExecutor      = triggerExecutor ?? throw new ArgumentNullException(nameof(triggerExecutor));
            _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
            _fileProcessorFactory = fileProcessorFactory ?? throw new ArgumentNullException(nameof(fileProcessorFactory));

            _cancellationTokenSource = new CancellationTokenSource();

            if (string.IsNullOrEmpty(_options.Value.RootFolder) || !Directory.Exists(_options.Value.RootFolder))
            {
                throw new InvalidOperationException(string.Format("Path '{0}' is invalid. FilesConfiguration.RootPath must be set to a valid directory location.", _options.Value.RootFolder));
            }

            //RWM: Use reflection because _attribute.GetRootPath() is internal.
            var dynMethod     = _attribute.GetType().GetMethod("GetRootPath", BindingFlags.NonPublic | BindingFlags.Instance);
            var attributePath = dynMethod.Invoke(_attribute, null);

            _watchPath = Path.Combine(_options.Value.RootFolder, attributePath.ToString());
        }
示例#3
0
 public SimpleMessageBusFileTriggerAttributeBindingProvider(IOptions <FileSystemOptions> options, ILoggerFactory loggerFactory, ISimpleMessageBusFileProcessorFactory fileProcessorFactory)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
     _logger  = loggerFactory?.CreateLogger(LogCategories.CreateTriggerCategory("File"));
     _fileProcessorFactory = fileProcessorFactory ?? throw new ArgumentNullException(nameof(fileProcessorFactory));
 }
 public SimpleMessageBusFilesExtensionConfigProvider(IOptions <FileSystemOptions> options, ILoggerFactory loggerFactory, ISimpleMessageBusFileProcessorFactory fileProcessorFactory)
 {
     _options              = options;
     _loggerFactory        = loggerFactory;
     _fileProcessorFactory = fileProcessorFactory;
 }