public KafkaListener( ITriggeredFunctionExecutor executor, bool singleDispatch, KafkaOptions options, KafkaListenerConfiguration kafkaListenerConfiguration, object valueDeserializer, ILogger logger) { this.valueDeserializer = valueDeserializer; this.executor = executor; this.singleDispatch = singleDispatch; this.options = options; this.listenerConfiguration = kafkaListenerConfiguration; this.logger = logger; this.cancellationTokenSource = new CancellationTokenSource(); }
public KafkaListener( ITriggeredFunctionExecutor executor, bool singleDispatch, KafkaOptions options, string brokerList, string topic, string consumerGroup, string eventHubConnectionString, ILogger logger) { this.executor = executor; this.singleDispatch = singleDispatch; this.options = options; this.logger = logger; this.brokerList = brokerList; this.topic = topic; this.consumerGroup = consumerGroup; this.eventHubConnectionString = eventHubConnectionString; this.cancellationTokenSource = new CancellationTokenSource(); }
public static IListener CreateFor(KafkaTriggerAttribute attribute, Type parameterType, ITriggeredFunctionExecutor executor, bool singleDispatch, KafkaOptions options, KafkaListenerConfiguration consumerKafkaConfiguration, ILogger logger) { var valueType = SerializationHelper.GetValueType(attribute.ValueType, attribute.AvroSchema, parameterType, out var avroSchema); var valueDeserializer = SerializationHelper.ResolveValueDeserializer(valueType, avroSchema); return((IListener)Activator.CreateInstance( typeof(KafkaListener <,>).MakeGenericType(attribute.KeyType ?? typeof(Ignore), valueType), new object[] { executor, singleDispatch, options, consumerKafkaConfiguration, valueDeserializer, logger })); }
public KafkaListener( ITriggeredFunctionExecutor executor, bool singleDispatch, KafkaOptions options, KafkaListenerConfiguration kafkaListenerConfiguration, bool requiresKey, IDeserializer <TValue> valueDeserializer, ILogger logger, string functionId) { this.ValueDeserializer = valueDeserializer; this.executor = executor; this.singleDispatch = singleDispatch; this.options = options; this.listenerConfiguration = kafkaListenerConfiguration; this.requiresKey = requiresKey; this.logger = logger; this.cancellationTokenSource = new CancellationTokenSource(); this.consumerGroup = string.IsNullOrEmpty(this.listenerConfiguration.ConsumerGroup) ? "$Default" : this.listenerConfiguration.ConsumerGroup; this.topicName = this.listenerConfiguration.Topic; this.functionId = functionId; this.consumer = new Lazy <IConsumer <TKey, TValue> >(() => CreateConsumer()); this.topicScaler = new Lazy <KafkaTopicScaler <TKey, TValue> >(() => CreateTopicScaler()); }