public PerperStreamListener(PerperStreamTriggerAttribute attribute, string delegateName, ITriggeredFunctionExecutor executor, IPerperFabricContext context, ILogger logger) { _attribute = attribute; _delegateName = delegateName; _executor = executor; _context = context; _logger = logger; _listenCancellationTokenSource = new CancellationTokenSource(); }
public Task <IListener> CreateListenerAsync(ListenerFactoryContext context) { return(Task.FromResult <IListener>(_attribute switch { PerperStreamTriggerAttribute streamAttribute => new PerperStreamListener(streamAttribute, context.Descriptor.FullName, context.Executor, _fabricContext, _logger), PerperWorkerTriggerAttribute workerAttribute => new PerperWorkerListener(workerAttribute, context.Descriptor.FullName, _workerTriggerValueConverter, context.Executor, _fabricContext), PerperModuleTriggerAttribute moduleAttribute => new PerperModuleListener(moduleAttribute, context.Descriptor.FullName, context.Executor, _fabricContext), _ => throw new ArgumentException() }));