public static ITriggerBindingProvider Create(INameResolver nameResolver,
            IStorageAccountProvider storageAccountProvider,
            IExtensionTypeLocator extensionTypeLocator,
            IHostIdProvider hostIdProvider,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            IContextSetter<IBlobWrittenWatcher> blobWrittenWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            IExtensionRegistry extensions,
            TextWriter log)
        {
            List<ITriggerBindingProvider> innerProviders = new List<ITriggerBindingProvider>();
            innerProviders.Add(new QueueTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                queueConfiguration, backgroundExceptionDispatcher, messageEnqueuedWatcherSetter,
                sharedContextProvider, log));
            innerProviders.Add(new BlobTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                extensionTypeLocator, hostIdProvider, queueConfiguration, backgroundExceptionDispatcher,
                blobWrittenWatcherSetter, messageEnqueuedWatcherSetter, sharedContextProvider, log));

            // add any registered extension binding providers
            foreach (ITriggerBindingProvider provider in extensions.GetExtensions(typeof(ITriggerBindingProvider)))
            {
                innerProviders.Add(provider);
            }

            return new CompositeTriggerBindingProvider(innerProviders);
        }
        public static ITriggerBindingProvider Create(INameResolver nameResolver,
                                                     IStorageAccountProvider storageAccountProvider,
                                                     IServiceBusAccountProvider serviceBusAccountProvider,
                                                     IExtensionTypeLocator extensionTypeLocator,
                                                     IHostIdProvider hostIdProvider,
                                                     IQueueConfiguration queueConfiguration,
                                                     IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                                     IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                     IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                                     ISharedContextProvider sharedContextProvider,
                                                     TextWriter log)
        {
            List <ITriggerBindingProvider> innerProviders = new List <ITriggerBindingProvider>();

            innerProviders.Add(new QueueTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                                                                        queueConfiguration, backgroundExceptionDispatcher, messageEnqueuedWatcherSetter,
                                                                        sharedContextProvider, log));
            innerProviders.Add(new BlobTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                                                                       extensionTypeLocator, hostIdProvider, queueConfiguration, backgroundExceptionDispatcher,
                                                                       blobWrittenWatcherSetter, messageEnqueuedWatcherSetter, sharedContextProvider, log));

            Type serviceBusProviderType = ServiceBusExtensionTypeLoader.Get(
                "Microsoft.Azure.WebJobs.ServiceBus.Triggers.ServiceBusTriggerAttributeBindingProvider");

            if (serviceBusProviderType != null)
            {
                ITriggerBindingProvider serviceBusAttributeBindingProvider =
                    (ITriggerBindingProvider)Activator.CreateInstance(serviceBusProviderType, nameResolver,
                                                                      serviceBusAccountProvider);
                innerProviders.Add(serviceBusAttributeBindingProvider);
            }

            return(new CompositeTriggerBindingProvider(innerProviders));
        }
예제 #3
0
        public BlobTriggerAttributeBindingProvider(INameResolver nameResolver,
                                                   StorageAccountProvider accountProvider,
                                                   IHostIdProvider hostIdProvider,
                                                   IOptions <QueuesOptions> queueOptions,
                                                   IOptions <BlobsOptions> blobsOptions,
                                                   IWebJobsExceptionHandler exceptionHandler,
                                                   IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                                   SharedQueueWatcher messageEnqueuedWatcherSetter,
                                                   ISharedContextProvider sharedContextProvider,
                                                   IHostSingletonManager singletonManager,
                                                   ILoggerFactory loggerFactory)
        {
            _accountProvider              = accountProvider ?? throw new ArgumentNullException(nameof(accountProvider));
            _hostIdProvider               = hostIdProvider ?? throw new ArgumentNullException(nameof(hostIdProvider));
            _queueOptions                 = (queueOptions ?? throw new ArgumentNullException(nameof(queueOptions))).Value;
            _blobsOptions                 = (blobsOptions ?? throw new ArgumentNullException(nameof(blobsOptions))).Value;
            _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _blobWrittenWatcherSetter     = blobWrittenWatcherSetter ?? throw new ArgumentNullException(nameof(blobWrittenWatcherSetter));
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
            _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
            _singletonManager             = singletonManager ?? throw new ArgumentNullException(nameof(singletonManager));

            _nameResolver  = nameResolver;
            _loggerFactory = loggerFactory;
        }
예제 #4
0
        public static ITriggerBindingProvider Create(INameResolver nameResolver,
                                                     IStorageAccountProvider storageAccountProvider,
                                                     IExtensionTypeLocator extensionTypeLocator,
                                                     IHostIdProvider hostIdProvider,
                                                     IQueueConfiguration queueConfiguration,
                                                     JobHostBlobsConfiguration blobsConfiguration,
                                                     IWebJobsExceptionHandler exceptionHandler,
                                                     IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                     IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                                     ISharedContextProvider sharedContextProvider,
                                                     IExtensionRegistry extensions,
                                                     SingletonManager singletonManager,
                                                     TraceWriter trace,
                                                     ILoggerFactory loggerFactory)
        {
            List <ITriggerBindingProvider> innerProviders = new List <ITriggerBindingProvider>();

            innerProviders.Add(new QueueTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                                                                        queueConfiguration, exceptionHandler, messageEnqueuedWatcherSetter,
                                                                        sharedContextProvider, trace, loggerFactory));
            innerProviders.Add(new BlobTriggerAttributeBindingProvider(nameResolver, storageAccountProvider, extensionTypeLocator,
                                                                       hostIdProvider, queueConfiguration, blobsConfiguration, exceptionHandler, blobWrittenWatcherSetter,
                                                                       messageEnqueuedWatcherSetter, sharedContextProvider, singletonManager, trace, loggerFactory));

            // add any registered extension binding providers
            foreach (ITriggerBindingProvider provider in extensions.GetExtensions(typeof(ITriggerBindingProvider)))
            {
                innerProviders.Add(provider);
            }

            return(new CompositeTriggerBindingProvider(innerProviders));
        }
 public BlobListenerFactory(IHostIdProvider hostIdProvider,
                            BlobsOptions blobsOptions,
                            IWebJobsExceptionHandler exceptionHandler,
                            IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                            SharedQueueWatcher messageEnqueuedWatcherSetter,
                            ISharedContextProvider sharedContextProvider,
                            ILoggerFactory loggerFactory,
                            FunctionDescriptor functionDescriptor,
                            BlobServiceClient hostBlobServiceClient,
                            QueueServiceClient hostQueueServiceClient,
                            BlobServiceClient dataBlobServiceClient,
                            QueueServiceClient dataQueueServiceClient,
                            BlobContainerClient container,
                            IBlobPathSource input,
                            ITriggeredFunctionExecutor executor,
                            IHostSingletonManager singletonManager)
 {
     _hostIdProvider               = hostIdProvider ?? throw new ArgumentNullException(nameof(hostIdProvider));
     _blobsOptions                 = blobsOptions ?? throw new ArgumentNullException(nameof(blobsOptions));
     _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
     _blobWrittenWatcherSetter     = blobWrittenWatcherSetter ?? throw new ArgumentNullException(nameof(blobWrittenWatcherSetter));
     _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
     _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
     _functionDescriptor           = functionDescriptor ?? throw new ArgumentNullException(nameof(functionDescriptor));
     _loggerFactory                = loggerFactory;
     _hostBlobServiceClient        = hostBlobServiceClient ?? throw new ArgumentNullException(nameof(hostBlobServiceClient));
     _hostQueueServiceClient       = hostQueueServiceClient ?? throw new ArgumentNullException(nameof(hostQueueServiceClient));
     _dataBlobServiceClient        = dataBlobServiceClient ?? throw new ArgumentNullException(nameof(dataBlobServiceClient));
     _dataQueueServiceClient       = dataQueueServiceClient ?? throw new ArgumentNullException(nameof(dataQueueServiceClient));
     _container        = container ?? throw new ArgumentNullException(nameof(container));
     _input            = input ?? throw new ArgumentNullException(nameof(input));
     _executor         = executor ?? throw new ArgumentNullException(nameof(executor));
     _singletonManager = singletonManager ?? throw new ArgumentNullException(nameof(singletonManager));
 }
 public BlobListenerFactory(IHostIdProvider hostIdProvider,
                            QueuesOptions queueOptions,
                            BlobsOptions blobsOptions,
                            IWebJobsExceptionHandler exceptionHandler,
                            IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                            SharedQueueWatcher messageEnqueuedWatcherSetter,
                            ISharedContextProvider sharedContextProvider,
                            ILoggerFactory loggerFactory,
                            string functionId,
                            StorageAccount hostAccount,
                            StorageAccount dataAccount,
                            CloudBlobContainer container,
                            IBlobPathSource input,
                            ITriggeredFunctionExecutor executor,
                            IHostSingletonManager singletonManager)
 {
     _hostIdProvider               = hostIdProvider ?? throw new ArgumentNullException(nameof(hostIdProvider));
     _queueOptions                 = queueOptions ?? throw new ArgumentNullException(nameof(queueOptions));
     _blobsOptions                 = blobsOptions ?? throw new ArgumentNullException(nameof(blobsOptions));
     _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
     _blobWrittenWatcherSetter     = blobWrittenWatcherSetter ?? throw new ArgumentNullException(nameof(blobWrittenWatcherSetter));
     _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
     _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
     _loggerFactory                = loggerFactory;
     _functionId       = functionId;
     _hostAccount      = hostAccount ?? throw new ArgumentNullException(nameof(hostAccount));
     _dataAccount      = dataAccount ?? throw new ArgumentNullException(nameof(dataAccount));
     _container        = container ?? throw new ArgumentNullException(nameof(container));
     _input            = input ?? throw new ArgumentNullException(nameof(input));
     _executor         = executor ?? throw new ArgumentNullException(nameof(executor));
     _singletonManager = singletonManager ?? throw new ArgumentNullException(nameof(singletonManager));
 }
예제 #7
0
        public DispatchQueueTests()
        {
            _accountProviderMock = new Mock <IStorageAccountProvider>();
            IStorageAccountProvider accountProvider = new FakeStorageAccountProvider
            {
                StorageAccount = new FakeStorageAccount()
            };

            _accountProviderMock.Setup(m => m.TryGetAccountAsync(ConnectionStringNames.Storage, It.IsAny <CancellationToken>()))
            .Returns <string, CancellationToken>((name, cancel) => accountProvider.TryGetAccountAsync(name, cancel));

            _hostIdMock = new Mock <IHostIdProvider>();
            _hostIdMock.Setup(m => m.GetHostIdAsync(It.IsAny <CancellationToken>())).ReturnsAsync(HostId);

            _exceptionMock = new Mock <IWebJobsExceptionHandler>();

            _queueConfiguration = new FakeQueuesOptionsFactory(accountProvider).Create(string.Empty);

            _sharedContextProvider = new SharedContextProvider();

            _messageEnqueueSetterMock = new Mock <IContextSetter <IMessageEnqueuedWatcher> >();

            ILoggerFactory factory = new LoggerFactory();

            factory.AddProvider(_loggerProvider);

            _sharedQueue = new SharedQueueHandler(_accountProviderMock.Object,
                                                  _hostIdMock.Object,
                                                  _exceptionMock.Object,
                                                  factory,
                                                  new OptionsWrapper <JobHostQueuesOptions>(_queueConfiguration),
                                                  _sharedContextProvider,
                                                  _messageEnqueueSetterMock.Object
                                                  );
        }
        public BlobTriggerAttributeBindingProvider(
            INameResolver nameResolver,
            BlobServiceClientProvider blobServiceClientProvider,
            QueueServiceClientProvider queueServiceClientProvider,
            IHostIdProvider hostIdProvider,
            IOptions <BlobsOptions> blobsOptions,
            IWebJobsExceptionHandler exceptionHandler,
            IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
            BlobTriggerQueueWriterFactory blobTriggerQueueWriterFactory,
            ISharedContextProvider sharedContextProvider,
            IHostSingletonManager singletonManager,
            ILoggerFactory loggerFactory)
        {
            _blobServiceClientProvider  = blobServiceClientProvider ?? throw new ArgumentNullException(nameof(blobServiceClientProvider));
            _queueServiceClientProvider = queueServiceClientProvider ?? throw new ArgumentNullException(nameof(queueServiceClientProvider));
            _hostIdProvider             = hostIdProvider ?? throw new ArgumentNullException(nameof(hostIdProvider));
            _blobsOptions                  = (blobsOptions ?? throw new ArgumentNullException(nameof(blobsOptions))).Value;
            _exceptionHandler              = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _blobWrittenWatcherSetter      = blobWrittenWatcherSetter ?? throw new ArgumentNullException(nameof(blobWrittenWatcherSetter));
            _blobTriggerQueueWriterFactory = blobTriggerQueueWriterFactory ?? throw new ArgumentNullException(nameof(blobTriggerQueueWriterFactory));
            _sharedContextProvider         = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
            _singletonManager              = singletonManager ?? throw new ArgumentNullException(nameof(singletonManager));

            _nameResolver  = nameResolver;
            _loggerFactory = loggerFactory;
            _logger        = loggerFactory.CreateLogger <BlobTriggerAttributeBindingProvider>();
        }
        public BlobTriggerBinding(ParameterInfo parameter,
                                  BlobServiceClient hostBlobServiceClient,
                                  QueueServiceClient hostQueueServiceClient,
                                  BlobServiceClient dataBlobServiceClient,
                                  QueueServiceClient dataQueueServiceClient,
                                  IBlobPathSource path,
                                  IHostIdProvider hostIdProvider,
                                  BlobsOptions blobsOptions,
                                  IWebJobsExceptionHandler exceptionHandler,
                                  IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                  SharedQueueWatcher messageEnqueuedWatcherSetter,
                                  ISharedContextProvider sharedContextProvider,
                                  IHostSingletonManager singletonManager,
                                  ILoggerFactory loggerFactory)
        {
            _parameter              = parameter ?? throw new ArgumentNullException(nameof(parameter));
            _hostBlobServiceClient  = hostBlobServiceClient ?? throw new ArgumentNullException(nameof(hostBlobServiceClient));
            _hostQueueServiceClient = hostQueueServiceClient ?? throw new ArgumentNullException(nameof(hostQueueServiceClient));
            _dataBlobServiceClient  = dataBlobServiceClient ?? throw new ArgumentNullException(nameof(dataBlobServiceClient));
            _dataQueueServiceClient = dataQueueServiceClient ?? throw new ArgumentNullException(nameof(dataQueueServiceClient));

            _accountName                  = _dataBlobServiceClient.AccountName;
            _path                         = path ?? throw new ArgumentNullException(nameof(path));
            _hostIdProvider               = hostIdProvider ?? throw new ArgumentNullException(nameof(hostIdProvider));
            _blobsOptions                 = blobsOptions ?? throw new ArgumentNullException(nameof(blobsOptions));
            _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _blobWrittenWatcherSetter     = blobWrittenWatcherSetter ?? throw new ArgumentNullException(nameof(blobWrittenWatcherSetter));
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
            _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
            _singletonManager             = singletonManager ?? throw new ArgumentNullException(nameof(singletonManager));
            _loggerFactory                = loggerFactory;
            _converter                    = CreateConverter(_dataBlobServiceClient);
            _bindingDataContract          = CreateBindingDataContract(path);
        }
        public BlobTriggerAttributeBindingProvider(INameResolver nameResolver,
                                                   IStorageAccountProvider accountProvider,
                                                   IExtensionTypeLocator extensionTypeLocator,
                                                   IHostIdProvider hostIdProvider,
                                                   IQueueConfiguration queueConfiguration,
                                                   JobHostBlobsConfiguration blobsConfiguration,
                                                   IWebJobsExceptionHandler exceptionHandler,
                                                   IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                   ISharedContextProvider sharedContextProvider,
                                                   SingletonManager singletonManager,
                                                   ILoggerFactory loggerFactory)
        {
            if (extensionTypeLocator == null)
            {
                throw new ArgumentNullException(nameof(extensionTypeLocator));
            }

            _accountProvider              = accountProvider ?? throw new ArgumentNullException(nameof(accountProvider));
            _hostIdProvider               = hostIdProvider ?? throw new ArgumentNullException(nameof(hostIdProvider));
            _queueConfiguration           = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _blobsConfiguration           = blobsConfiguration ?? throw new ArgumentNullException(nameof(blobsConfiguration));
            _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _blobWrittenWatcherSetter     = blobWrittenWatcherSetter ?? throw new ArgumentNullException(nameof(blobWrittenWatcherSetter));
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
            _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
            _singletonManager             = singletonManager ?? throw new ArgumentNullException(nameof(singletonManager));

            _nameResolver  = nameResolver;
            _loggerFactory = loggerFactory;
        }
        public static ITriggerBindingProvider Create(INameResolver nameResolver,
                                                     IStorageAccountProvider storageAccountProvider,
                                                     IExtensionTypeLocator extensionTypeLocator,
                                                     IHostIdProvider hostIdProvider,
                                                     IQueueConfiguration queueConfiguration,
                                                     IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                                     IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                     IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                                     ISharedContextProvider sharedContextProvider,
                                                     IExtensionRegistry extensions,
                                                     TextWriter log)
        {
            List <ITriggerBindingProvider> innerProviders = new List <ITriggerBindingProvider>();

            innerProviders.Add(new QueueTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                                                                        queueConfiguration, backgroundExceptionDispatcher, messageEnqueuedWatcherSetter,
                                                                        sharedContextProvider, log));
            innerProviders.Add(new BlobTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
                                                                       extensionTypeLocator, hostIdProvider, queueConfiguration, backgroundExceptionDispatcher,
                                                                       blobWrittenWatcherSetter, messageEnqueuedWatcherSetter, sharedContextProvider, log));

            // add any registered extension binding providers
            foreach (ITriggerBindingProvider provider in extensions.GetExtensions(typeof(ITriggerBindingProvider)))
            {
                innerProviders.Add(provider);
            }

            return(new CompositeTriggerBindingProvider(innerProviders));
        }
예제 #12
0
        public QueueTriggerBinding(string parameterName,
                                   IStorageQueue queue,
                                   ITriggerDataArgumentBinding <IStorageQueueMessage> argumentBinding,
                                   IQueueConfiguration queueConfiguration,
                                   IWebJobsExceptionHandler exceptionHandler,
                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                   ISharedContextProvider sharedContextProvider,
                                   TraceWriter trace,
                                   ILoggerFactory loggerFactory)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (argumentBinding == null)
            {
                throw new ArgumentNullException("argumentBinding");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (exceptionHandler == null)
            {
                throw new ArgumentNullException("exceptionHandler");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            _parameterName                = parameterName;
            _queue                        = queue;
            _argumentBinding              = argumentBinding;
            _bindingDataContract          = CreateBindingDataContract(argumentBinding.BindingDataContract);
            _queueConfiguration           = queueConfiguration;
            _exceptionHandler             = exceptionHandler;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider        = sharedContextProvider;
            _trace                        = trace;
            _loggerFactory                = loggerFactory;
            _converter                    = CreateConverter(queue);
        }
예제 #13
0
        public QueueTriggerBinding(string parameterName,
                                   IStorageQueue queue,
                                   ITriggerDataArgumentBinding <IStorageQueueMessage> argumentBinding,
                                   IQueueConfiguration queueConfiguration,
                                   IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                   ISharedContextProvider sharedContextProvider,
                                   TextWriter log)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (argumentBinding == null)
            {
                throw new ArgumentNullException("argumentBinding");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            _parameterName                 = parameterName;
            _queue                         = queue;
            _argumentBinding               = argumentBinding;
            _bindingDataContract           = CreateBindingDataContract(argumentBinding);
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _log       = log;
            _converter = CreateConverter(queue);
        }
        public QueueTriggerBinding(string parameterName,
            IStorageQueue queue,
            ITriggerDataArgumentBinding<IStorageQueueMessage> argumentBinding,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            TextWriter log)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (argumentBinding == null)
            {
                throw new ArgumentNullException("argumentBinding");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            _parameterName = parameterName;
            _queue = queue;
            _argumentBinding = argumentBinding;
            _bindingDataContract = CreateBindingDataContract(argumentBinding);
            _queueConfiguration = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider = sharedContextProvider;
            _log = log;
            _converter = CreateConverter(queue);
        }
예제 #15
0
        public QueueListenerFactory(IStorageQueue queue,
                                    IQueueConfiguration queueConfiguration,
                                    IWebJobsExceptionHandler exceptionHandler,
                                    IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                    ISharedContextProvider sharedContextProvider,
                                    TraceWriter trace,
                                    ILoggerFactory loggerFactory,
                                    ITriggeredFunctionExecutor executor)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (exceptionHandler == null)
            {
                throw new ArgumentNullException("exceptionHandler");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            if (executor == null)
            {
                throw new ArgumentNullException("executor");
            }

            _queue                        = queue;
            _poisonQueue                  = CreatePoisonQueueReference(queue.ServiceClient, queue.Name);
            _queueConfiguration           = queueConfiguration;
            _exceptionHandler             = exceptionHandler;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider        = sharedContextProvider;
            _trace                        = trace;
            _loggerFactory                = loggerFactory;
            _executor                     = executor;
        }
예제 #16
0
        public QueueListenerFactory(IStorageQueue queue,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            TraceWriter trace,
            ITriggeredFunctionExecutor executor)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            if (executor == null)
            {
                throw new ArgumentNullException("executor");
            }

            _queue = queue;
            _poisonQueue = CreatePoisonQueueReference(queue.ServiceClient, queue.Name);
            _queueConfiguration = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider = sharedContextProvider;
            _trace = trace;
            _executor = executor;
        }
예제 #17
0
        public QueueListenerFactory(IStorageQueue queue,
                                    IQueueConfiguration queueConfiguration,
                                    IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                    IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                    ISharedContextProvider sharedContextProvider,
                                    TextWriter log,
                                    ITriggeredFunctionExecutor executor)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            if (executor == null)
            {
                throw new ArgumentNullException("executor");
            }

            _queue                         = queue;
            _poisonQueue                   = CreatePoisonQueueReference(queue.ServiceClient, queue.Name);
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _log      = log;
            _executor = executor;
        }
        private IListener CreateQueueMessageToTriggerExecutionListener(IFunctionExecutor executor,
                                                                       ISharedContextProvider sharedContextProvider,
                                                                       SharedQueueWatcher sharedQueueWatcher,
                                                                       IStorageQueueClient queueClient,
                                                                       IStorageQueue hostBlobTriggerQueue,
                                                                       IStorageBlobClient blobClient,
                                                                       IBlobWrittenWatcher blobWrittenWatcher)
        {
            SharedBlobQueueListener sharedListener = sharedContextProvider.GetOrCreate <SharedBlobQueueListener>(
                new SharedBlobQueueListenerFactory(executor, sharedQueueWatcher, queueClient, hostBlobTriggerQueue,
                                                   blobClient, _queueConfiguration, _backgroundExceptionDispatcher, _log, blobWrittenWatcher));

            sharedListener.Register(_functionId, _instanceFactory);
            return(new BlobListener(sharedListener));
        }
예제 #19
0
 public SharedQueueHandler(
     IHostIdProvider hostIdProvider,
     IWebJobsExceptionHandler exceptionHandler,
     ILoggerFactory loggerFactory,
     ISharedContextProvider sharedContextProvider,
     ILoadBalancerQueue queueFactory
     )
 {
     _hostIdProvider        = hostIdProvider;
     _exceptionHandler      = exceptionHandler;
     _loggerFactory         = loggerFactory;
     _sharedContextProvider = sharedContextProvider;
     _state        = State.Created;
     _queueFactory = queueFactory;
 }
예제 #20
0
        public QueueTriggerAttributeBindingProvider(INameResolver nameResolver,
                                                    IStorageAccountProvider accountProvider,
                                                    IQueueConfiguration queueConfiguration,
                                                    IWebJobsExceptionHandler exceptionHandler,
                                                    IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                    ISharedContextProvider sharedContextProvider,
                                                    TraceWriter trace,
                                                    ILoggerFactory loggerFactory)
        {
            if (accountProvider == null)
            {
                throw new ArgumentNullException("accountProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (exceptionHandler == null)
            {
                throw new ArgumentNullException("exceptionHandler");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            _nameResolver                 = nameResolver;
            _accountProvider              = accountProvider;
            _queueConfiguration           = queueConfiguration;
            _exceptionHandler             = exceptionHandler;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider        = sharedContextProvider;
            _trace         = trace;
            _loggerFactory = loggerFactory;
        }
        public QueueTriggerAttributeBindingProvider(INameResolver nameResolver,
            IStorageAccountProvider accountProvider,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            TextWriter log)
        {
            if (accountProvider == null)
            {
                throw new ArgumentNullException("accountProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            _nameResolver = nameResolver;
            _accountProvider = accountProvider;
            _queueConfiguration = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider = sharedContextProvider;
            _log = log;
        }
예제 #22
0
 internal SharedQueueHandler(IStorageAccountProvider accountProvider,
                             IHostIdProvider hostIdProvider,
                             IWebJobsExceptionHandler exceptionHandler,
                             ILoggerFactory loggerFactory,
                             IQueueConfiguration queueConfiguration,
                             ISharedContextProvider sharedContextProvider,
                             IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter)
 {
     _accountProvider              = accountProvider;
     _hostIdProvider               = hostIdProvider;
     _exceptionHandler             = exceptionHandler;
     _loggerFactory                = loggerFactory;
     _queueConfiguration           = queueConfiguration;
     _sharedContextProvider        = sharedContextProvider;
     _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
     _state = State.Created;
 }
        public QueueTriggerAttributeBindingProvider(INameResolver nameResolver,
                                                    IStorageAccountProvider accountProvider,
                                                    IQueueConfiguration queueConfiguration,
                                                    IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                                    IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                    ISharedContextProvider sharedContextProvider,
                                                    TextWriter log)
        {
            if (accountProvider == null)
            {
                throw new ArgumentNullException("accountProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            _nameResolver                  = nameResolver;
            _accountProvider               = accountProvider;
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _log = log;
        }
        public QueueTriggerAttributeBindingProvider(INameResolver nameResolver,
                                                    IStorageAccountProvider accountProvider,
                                                    IQueueConfiguration queueConfiguration,
                                                    IWebJobsExceptionHandler exceptionHandler,
                                                    IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                    ISharedContextProvider sharedContextProvider,
                                                    ILoggerFactory loggerFactory)
        {
            _accountProvider              = accountProvider ?? throw new ArgumentNullException(nameof(accountProvider));
            _queueConfiguration           = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
            _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));

            _nameResolver  = nameResolver;
            _loggerFactory = loggerFactory;
        }
예제 #25
0
        public QueueListenerFactory(IStorageQueue queue,
                                    IQueueConfiguration queueConfiguration,
                                    IWebJobsExceptionHandler exceptionHandler,
                                    IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                    ISharedContextProvider sharedContextProvider,
                                    ILoggerFactory loggerFactory,
                                    ITriggeredFunctionExecutor executor)
        {
            _queue = queue ?? throw new ArgumentNullException(nameof(queue));
            _queueConfiguration           = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
            _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
            _executor = executor ?? throw new ArgumentNullException(nameof(executor));

            _poisonQueue   = CreatePoisonQueueReference(queue.ServiceClient, queue.Name);
            _loggerFactory = loggerFactory;
        }
        public QueueTriggerBinding(string parameterName,
                                   IStorageQueue queue,
                                   ITriggerDataArgumentBinding <IStorageQueueMessage> argumentBinding,
                                   IQueueConfiguration queueConfiguration,
                                   IWebJobsExceptionHandler exceptionHandler,
                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                   ISharedContextProvider sharedContextProvider,
                                   ILoggerFactory loggerFactory)
        {
            _queue                        = queue ?? throw new ArgumentNullException(nameof(queue));
            _argumentBinding              = argumentBinding ?? throw new ArgumentNullException(nameof(argumentBinding));
            _bindingDataContract          = CreateBindingDataContract(argumentBinding.BindingDataContract);
            _queueConfiguration           = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
            _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));

            _parameterName = parameterName;
            _loggerFactory = loggerFactory;
            _converter     = CreateConverter(queue);
        }
예제 #27
0
        private IListener CreateQueueMessageToTriggerExecutionListener(
            ISharedContextProvider sharedContextProvider,
            SharedQueueWatcher sharedQueueWatcher,
            IStorageQueueClient queueClient,
            IStorageQueue hostBlobTriggerQueue,
            IStorageBlobClient blobClient,
            IBlobWrittenWatcher blobWrittenWatcher)
        {
            SharedBlobQueueListener sharedListener = sharedContextProvider.GetOrCreate <SharedBlobQueueListener>(
                new SharedBlobQueueListenerFactory(sharedQueueWatcher, queueClient, hostBlobTriggerQueue,
                                                   _queueConfiguration, _backgroundExceptionDispatcher, _trace, blobWrittenWatcher));

            BlobQueueRegistration registration = new BlobQueueRegistration
            {
                Executor   = _executor,
                BlobClient = blobClient
            };

            sharedListener.Register(_functionId, registration);

            return(new BlobListener(sharedListener));
        }
        public BlobTriggerBinding(ParameterInfo parameter,
                                  IStorageAccount hostAccount,
                                  IStorageAccount dataAccount,
                                  IBlobPathSource path,
                                  IHostIdProvider hostIdProvider,
                                  IQueueConfiguration queueConfiguration,
                                  JobHostBlobsConfiguration blobsConfiguration,
                                  IWebJobsExceptionHandler exceptionHandler,
                                  IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                  IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                  ISharedContextProvider sharedContextProvider,
                                  SingletonManager singletonManager,
                                  ILoggerFactory loggerFactory)
        {
            _parameter   = parameter ?? throw new ArgumentNullException(nameof(parameter));
            _hostAccount = hostAccount ?? throw new ArgumentNullException(nameof(hostAccount));
            _dataAccount = dataAccount ?? throw new ArgumentNullException(nameof(dataAccount));

            StorageClientFactoryContext context = new StorageClientFactoryContext
            {
                Parameter = parameter
            };

            _blobClient                   = dataAccount.CreateBlobClient(context);
            _accountName                  = BlobClient.GetAccountName(_blobClient);
            _path                         = path ?? throw new ArgumentNullException(nameof(path));
            _hostIdProvider               = hostIdProvider ?? throw new ArgumentNullException(nameof(hostIdProvider));
            _queueConfiguration           = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _blobsConfiguration           = blobsConfiguration ?? throw new ArgumentNullException(nameof(blobsConfiguration));
            _exceptionHandler             = exceptionHandler ?? throw new ArgumentNullException(nameof(exceptionHandler));
            _blobWrittenWatcherSetter     = blobWrittenWatcherSetter ?? throw new ArgumentNullException(nameof(blobWrittenWatcherSetter));
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter ?? throw new ArgumentNullException(nameof(messageEnqueuedWatcherSetter));
            _sharedContextProvider        = sharedContextProvider ?? throw new ArgumentNullException(nameof(sharedContextProvider));
            _singletonManager             = singletonManager ?? throw new ArgumentNullException(nameof(singletonManager));
            _loggerFactory                = loggerFactory;
            _converter                    = CreateConverter(_blobClient);
            _bindingDataContract          = CreateBindingDataContract(path);
        }
        public BlobTriggerBinding(ParameterInfo parameter,
                                  IArgumentBinding <IStorageBlob> argumentBinding,
                                  IStorageAccount hostAccount,
                                  IStorageAccount dataAccount,
                                  IBlobPathSource path,
                                  IHostIdProvider hostIdProvider,
                                  IQueueConfiguration queueConfiguration,
                                  IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                  IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                  IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                  ISharedContextProvider sharedContextProvider,
                                  SingletonManager singletonManager,
                                  TraceWriter trace)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            if (argumentBinding == null)
            {
                throw new ArgumentNullException("argumentBinding");
            }

            if (hostAccount == null)
            {
                throw new ArgumentNullException("hostAccount");
            }

            if (dataAccount == null)
            {
                throw new ArgumentNullException("dataAccount");
            }

            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (singletonManager == null)
            {
                throw new ArgumentNullException("singletonManager");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            _parameter       = parameter;
            _argumentBinding = argumentBinding;
            _hostAccount     = hostAccount;
            _dataAccount     = dataAccount;
            StorageClientFactoryContext context = new StorageClientFactoryContext
            {
                Parameter = parameter
            };

            _blobClient                    = dataAccount.CreateBlobClient(context);
            _accountName                   = BlobClient.GetAccountName(_blobClient);
            _path                          = path;
            _hostIdProvider                = hostIdProvider;
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter      = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _singletonManager              = singletonManager;
            _trace                         = trace;
            _converter                     = CreateConverter(_blobClient);
            _bindingDataContract           = CreateBindingDataContract(path);
        }
        public BlobTriggerBinding(ParameterInfo parameter,
            IArgumentBinding<IStorageBlob> argumentBinding,
            IStorageAccount hostAccount,
            IStorageAccount dataAccount,
            IBlobPathSource path,
            IHostIdProvider hostIdProvider,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IBlobWrittenWatcher> blobWrittenWatcherSetter,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            TraceWriter trace)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            if (argumentBinding == null)
            {
                throw new ArgumentNullException("argumentBinding");
            }

            if (hostAccount == null)
            {
                throw new ArgumentNullException("hostAccount");
            }

            if (dataAccount == null)
            {
                throw new ArgumentNullException("dataAccount");
            }

            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            _parameter = parameter;
            _argumentBinding = argumentBinding;
            _hostAccount = hostAccount;
            _dataAccount = dataAccount;
            StorageClientFactoryContext context = new StorageClientFactoryContext
            {
                Parameter = parameter
            };
            _blobClient = dataAccount.CreateBlobClient(context);
            _accountName = BlobClient.GetAccountName(_blobClient);
            _path = path;
            _hostIdProvider = hostIdProvider;
            _queueConfiguration = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider = sharedContextProvider;
            _trace = trace;
            _converter = CreateConverter(_blobClient);
            _bindingDataContract = CreateBindingDataContract(path);
        }
예제 #31
0
        public BlobListenerFactory(IHostIdProvider hostIdProvider,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IBlobWrittenWatcher> blobWrittenWatcherSetter,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            TraceWriter trace,
            string functionId,
            IStorageAccount hostAccount,
            IStorageAccount dataAccount,
            IStorageBlobContainer container,
            IBlobPathSource input,
            ITriggeredFunctionExecutor executor,
            SingletonManager singletonManager)
        {
            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            if (hostAccount == null)
            {
                throw new ArgumentNullException("hostAccount");
            }

            if (dataAccount == null)
            {
                throw new ArgumentNullException("dataAccount");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (executor == null)
            {
                throw new ArgumentNullException("executor");
            }

            if (singletonManager == null)
            {
                throw new ArgumentNullException("singletonManager");
            }

            _hostIdProvider = hostIdProvider;
            _queueConfiguration = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider = sharedContextProvider;
            _trace = trace;
            _functionId = functionId;
            _hostAccount = hostAccount;
            _dataAccount = dataAccount;
            _container = container;
            _input = input;
            _executor = executor;
            _singletonManager = singletonManager;
        }
        public BlobTriggerAttributeBindingProvider(INameResolver nameResolver,
                                                   IStorageAccountProvider accountProvider,
                                                   IExtensionTypeLocator extensionTypeLocator,
                                                   IHostIdProvider hostIdProvider,
                                                   IQueueConfiguration queueConfiguration,
                                                   IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                                   IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                                   ISharedContextProvider sharedContextProvider,
                                                   TraceWriter trace)
        {
            if (accountProvider == null)
            {
                throw new ArgumentNullException("accountProvider");
            }

            if (extensionTypeLocator == null)
            {
                throw new ArgumentNullException("extensionTypeLocator");
            }

            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            _nameResolver                  = nameResolver;
            _accountProvider               = accountProvider;
            _provider                      = CreateProvider(extensionTypeLocator.GetCloudBlobStreamBinderTypes());
            _hostIdProvider                = hostIdProvider;
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter      = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _trace = trace;
        }
예제 #33
0
        public BlobTriggerBinding(string parameterName,
            IArgumentBinding<IStorageBlob> argumentBinding,
            IStorageAccount account,
            IBlobPathSource path,
            IHostIdProvider hostIdProvider,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IBlobWrittenWatcher> blobWrittenWatcherSetter,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            TextWriter log)
        {
            if (argumentBinding == null)
            {
                throw new ArgumentNullException("argumentBinding");
            }

            if (account == null)
            {
                throw new ArgumentNullException("account");
            }

            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            _parameterName = parameterName;
            _argumentBinding = argumentBinding;
            _account = account;
            _client = account.CreateBlobClient();
            _accountName = BlobClient.GetAccountName(_client);
            _path = path;
            _hostIdProvider = hostIdProvider;
            _queueConfiguration = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider = sharedContextProvider;
            _log = log;
            _converter = CreateConverter(_client);
            _bindingDataContract = CreateBindingDataContract(path);
        }
예제 #34
0
        public BlobListenerFactory(IHostIdProvider hostIdProvider,
                                   IQueueConfiguration queueConfiguration,
                                   IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                   IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                   ISharedContextProvider sharedContextProvider,
                                   TraceWriter trace,
                                   string functionId,
                                   IStorageAccount account,
                                   IStorageBlobContainer container,
                                   IBlobPathSource input,
                                   ITriggeredFunctionExecutor executor)
        {
            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            if (account == null)
            {
                throw new ArgumentNullException("account");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (executor == null)
            {
                throw new ArgumentNullException("executor");
            }

            _hostIdProvider                = hostIdProvider;
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter      = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _trace      = trace;
            _functionId = functionId;
            _account    = account;
            _container  = container;
            _input      = input;
            _executor   = executor;
        }
        private IListener CreateQueueMessageToTriggerExecutionListener(
            ISharedContextProvider sharedContextProvider,
            SharedQueueWatcher sharedQueueWatcher,
            IStorageQueueClient queueClient,
            IStorageQueue hostBlobTriggerQueue,
            IStorageBlobClient blobClient,
            IBlobWrittenWatcher blobWrittenWatcher)
        {
            SharedBlobQueueListener sharedListener = sharedContextProvider.GetOrCreate<SharedBlobQueueListener>(
                new SharedBlobQueueListenerFactory(sharedQueueWatcher, queueClient, hostBlobTriggerQueue,
                    blobClient, _queueConfiguration, _backgroundExceptionDispatcher, _log, blobWrittenWatcher));

            sharedListener.Register(_functionId, _executor);

            return new BlobListener(sharedListener);
        }
        public BlobListenerFactory(IHostIdProvider hostIdProvider,
                                   IQueueConfiguration queueConfiguration,
                                   JobHostBlobsConfiguration blobsConfiguration,
                                   IWebJobsExceptionHandler exceptionHandler,
                                   IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                   ISharedContextProvider sharedContextProvider,
                                   TraceWriter trace,
                                   ILoggerFactory loggerFactory,
                                   string functionId,
                                   IStorageAccount hostAccount,
                                   IStorageAccount dataAccount,
                                   IStorageBlobContainer container,
                                   IBlobPathSource input,
                                   ITriggeredFunctionExecutor executor,
                                   SingletonManager singletonManager)
        {
            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (blobsConfiguration == null)
            {
                throw new ArgumentNullException("blobsConfiguration");
            }

            if (exceptionHandler == null)
            {
                throw new ArgumentNullException("exceptionHandler");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (trace == null)
            {
                throw new ArgumentNullException("trace");
            }

            if (hostAccount == null)
            {
                throw new ArgumentNullException("hostAccount");
            }

            if (dataAccount == null)
            {
                throw new ArgumentNullException("dataAccount");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (executor == null)
            {
                throw new ArgumentNullException("executor");
            }

            if (singletonManager == null)
            {
                throw new ArgumentNullException("singletonManager");
            }

            _hostIdProvider               = hostIdProvider;
            _queueConfiguration           = queueConfiguration;
            _blobsConfiguration           = blobsConfiguration;
            _exceptionHandler             = exceptionHandler;
            _blobWrittenWatcherSetter     = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider        = sharedContextProvider;
            _trace            = trace;
            _loggerFactory    = loggerFactory;
            _functionId       = functionId;
            _hostAccount      = hostAccount;
            _dataAccount      = dataAccount;
            _container        = container;
            _input            = input;
            _executor         = executor;
            _singletonManager = singletonManager;
        }
예제 #37
0
        public BlobTriggerBinding(string parameterName,
                                  IArgumentBinding <IStorageBlob> argumentBinding,
                                  IStorageAccount account,
                                  IBlobPathSource path,
                                  IHostIdProvider hostIdProvider,
                                  IQueueConfiguration queueConfiguration,
                                  IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                  IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                  IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                  ISharedContextProvider sharedContextProvider,
                                  TextWriter log)
        {
            if (argumentBinding == null)
            {
                throw new ArgumentNullException("argumentBinding");
            }

            if (account == null)
            {
                throw new ArgumentNullException("account");
            }

            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            _parameterName                 = parameterName;
            _argumentBinding               = argumentBinding;
            _account                       = account;
            _client                        = account.CreateBlobClient();
            _accountName                   = BlobClient.GetAccountName(_client);
            _path                          = path;
            _hostIdProvider                = hostIdProvider;
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter      = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _log                 = log;
            _converter           = CreateConverter(_client);
            _bindingDataContract = CreateBindingDataContract(path);
        }
        public BlobListenerFactory(IHostIdProvider hostIdProvider,
                                   IQueueConfiguration queueConfiguration,
                                   IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                   IContextSetter <IBlobWrittenWatcher> blobWrittenWatcherSetter,
                                   IContextSetter <IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
                                   ISharedContextProvider sharedContextProvider,
                                   TextWriter log,
                                   string functionId,
                                   IStorageAccount account,
                                   IStorageBlobContainer container,
                                   IBlobPathSource input,
                                   ITriggeredFunctionInstanceFactory <IStorageBlob> instanceFactory)
        {
            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            if (account == null)
            {
                throw new ArgumentNullException("account");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (instanceFactory == null)
            {
                throw new ArgumentNullException("instanceFactory");
            }

            _hostIdProvider                = hostIdProvider;
            _queueConfiguration            = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter      = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter  = messageEnqueuedWatcherSetter;
            _sharedContextProvider         = sharedContextProvider;
            _log             = log;
            _functionId      = functionId;
            _account         = account;
            _container       = container;
            _input           = input;
            _instanceFactory = instanceFactory;
        }
        public BlobListenerFactory(IHostIdProvider hostIdProvider,
            IQueueConfiguration queueConfiguration,
            IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
            IContextSetter<IBlobWrittenWatcher> blobWrittenWatcherSetter,
            IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
            ISharedContextProvider sharedContextProvider,
            TextWriter log,
            string functionId,
            IStorageAccount account,
            IStorageBlobContainer container,
            IBlobPathSource input,
            ITriggeredFunctionExecutor<IStorageBlob> executor)
        {
            if (hostIdProvider == null)
            {
                throw new ArgumentNullException("hostIdProvider");
            }

            if (queueConfiguration == null)
            {
                throw new ArgumentNullException("queueConfiguration");
            }

            if (backgroundExceptionDispatcher == null)
            {
                throw new ArgumentNullException("backgroundExceptionDispatcher");
            }

            if (blobWrittenWatcherSetter == null)
            {
                throw new ArgumentNullException("blobWrittenWatcherSetter");
            }

            if (messageEnqueuedWatcherSetter == null)
            {
                throw new ArgumentNullException("messageEnqueuedWatcherSetter");
            }

            if (sharedContextProvider == null)
            {
                throw new ArgumentNullException("sharedContextProvider");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            if (account == null)
            {
                throw new ArgumentNullException("account");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (executor == null)
            {
                throw new ArgumentNullException("executor");
            }

            _hostIdProvider = hostIdProvider;
            _queueConfiguration = queueConfiguration;
            _backgroundExceptionDispatcher = backgroundExceptionDispatcher;
            _blobWrittenWatcherSetter = blobWrittenWatcherSetter;
            _messageEnqueuedWatcherSetter = messageEnqueuedWatcherSetter;
            _sharedContextProvider = sharedContextProvider;
            _log = log;
            _functionId = functionId;
            _account = account;
            _container = container;
            _input = input;
            _executor = executor;
        }