public Task<ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context)
        {
            ParameterInfo parameter = context.Parameter;
            FakeQueueTriggerAttribute attribute = parameter.GetCustomAttribute<FakeQueueTriggerAttribute>(inherit: false);

            if (attribute == null)
            {
                return Task.FromResult<ITriggerBinding>(null);
            }

            var hooks = new FakeQueueTriggerBindingStrategy();

            Func<ListenerFactoryContext, bool, Task<IListener>> createListener =
                (factoryContext, singleDispatch) =>
                {
                    IListener listener = new FakeQueueListener(factoryContext.Executor, _client, singleDispatch);
                    return Task.FromResult(listener);
                };

            ITriggerBinding binding = BindingFactory.GetTriggerBinding<FakeQueueData, FakeQueueDataBatch>(
                hooks, parameter, _converterManager, createListener);

            return Task.FromResult<ITriggerBinding>(binding);

        }
Example #2
0
        public Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context)
        {
            ParameterInfo             parameter = context.Parameter;
            FakeQueueTriggerAttribute attribute = parameter.GetCustomAttribute <FakeQueueTriggerAttribute>(inherit: false);

            if (attribute == null)
            {
                return(Task.FromResult <ITriggerBinding>(null));
            }

            var hooks = new FakeQueueTriggerBindingStrategy();

            Func <ListenerFactoryContext, bool, Task <IListener> > createListener =
                (factoryContext, singleDispatch) =>
            {
                IListener listener = new FakeQueueListener(factoryContext.Executor, _client, singleDispatch);
                return(Task.FromResult(listener));
            };

            ITriggerBinding binding = BindingFactory.GetTriggerBinding <FakeQueueData, FakeQueueDataBatch>(
                hooks, parameter, _converterManager, createListener);

            return(Task.FromResult <ITriggerBinding>(binding));
        }