public KafkaAdapterFactory(
            string name,
            KafkaStreamOptions options,
            SimpleQueueCacheOptions cacheOptions,
            SerializationManager serializationManager,
            ILoggerFactory loggerFactory,
            IGrainFactory grainFactory,
            IExternalStreamDeserializer externalDeserializer
            )
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));

            _name = name;
            _serializationManager = serializationManager;
            _loggerFactory        = loggerFactory;
            _grainFactory         = grainFactory;
            _externalDeserializer = externalDeserializer;
            _logger = loggerFactory.CreateLogger <KafkaAdapterFactory>();

            if (options.Topics != null && options.Topics.Count == 0)
            {
                throw new ArgumentNullException(nameof(options.Topics));
            }

            _adapterCache = new SimpleQueueAdapterCache(
                cacheOptions,
                name,
                loggerFactory
                );

            _queueProperties   = GetQueuesProperties();
            _streamQueueMapper = new ExternalQueueMapper(_queueProperties.Values);
        }
 public KafkaExternalBatchContainer(
     Guid streamGuid,
     QueueProperties queueProps,
     List <byte[]> events,
     EventSequenceTokenV2 streamSequenceToken,
     TopicPartitionOffset offset,
     IExternalStreamDeserializer deserializer
     ) : base(streamGuid, queueProps.Namespace, events.Cast <object>().ToList(), null, streamSequenceToken, offset)
 {
     _queueProps   = queueProps;
     _deserializer = deserializer;
 }
        public KafkaAdapterReceiver(
            string providerName,
            QueueProperties queueProperties,
            KafkaStreamOptions options,
            SerializationManager serializationManager,
            ILoggerFactory loggerFactory,
            IGrainFactory grainFactory,
            IExternalStreamDeserializer externalDeserializer
            )
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));

            _providerName         = providerName;
            _queueProperties      = queueProperties;
            _serializationManager = serializationManager;
            _grainFactory         = grainFactory;
            _externalDeserializer = externalDeserializer;
            _logger = loggerFactory.CreateLogger <KafkaAdapterReceiver>();
        }
Beispiel #4
0
        public KafkaAdapter(
            string providerName,
            KafkaStreamOptions options,
            IDictionary <string, QueueProperties> queueProperties,
            SerializationManager serializationManager,
            ILoggerFactory loggerFactory,
            IGrainFactory grainFactory,
            IExternalStreamDeserializer externalDeserializer
            )
        {
            _options              = options;
            _queueProperties      = queueProperties;
            _serializationManager = serializationManager;
            _loggerFactory        = loggerFactory;
            _grainFactory         = grainFactory;
            _externalDeserializer = externalDeserializer;
            _logger = _loggerFactory.CreateLogger <KafkaAdapter>();

            Name = providerName;

            _producer = new ProducerBuilder <byte[], KafkaBatchContainer>(options.ToProducerProperties())
                        .SetValueSerializer(new KafkaBatchContainerSerializer(serializationManager))
                        .Build();
        }