internal ProcessorContext(AbstractTask task, IStreamConfig configuration, IStateManager stateManager)
        {
            Task          = task;
            Configuration = configuration;
            States        = stateManager;

            SerDesContext = new SerDesContext(configuration);
        }
Exemple #2
0
        internal ProcessorContext(AbstractTask task, IStreamConfig configuration, IStateManager stateManager,
                                  StreamMetricsRegistry streamMetricsRegistry)
        {
            Task          = task;
            Configuration = configuration;
            States        = stateManager;
            Metrics       = streamMetricsRegistry;

            SerDesContext = new SerDesContext(configuration);
        }
Exemple #3
0
        public override void Initialize(SerDesContext context)
        {
            if (innerSerdes == null && context.Config.DefaultValueSerDes is ISerDes <V> )
            {
                innerSerdes = (ISerDes <V>)context.Config.DefaultValueSerDes;
            }

            if (innerSerdes == null)
            {
                throw new StreamsException($"ChangeSerdes<{typeof(V)}> is not correctly configured. Please set explicitly serdes in previous operation.");
            }

            innerSerdes.Initialize(context);
        }
        /// <summary>
        /// Initialize method with a current context which contains <see cref="IStreamConfig"/>.
        /// Can be used to initialize the serdes according to some parameters present in the configuration such as the schema.registry.url
        /// </summary>
        /// <param name="context">SerDesContext with stream configuration</param>
        public override void Initialize(SerDesContext context)
        {
            if (!isInitialized)
            {
                if (context.Config is ISchemaRegistryConfig schemaConfig)
                {
                    registryClient = GetSchemaRegistryClient(GetConfig(schemaConfig));
                    deserializer   = new AvroDeserializer <T>(registryClient);
                    serializer     = new AvroSerializer <T>(registryClient, GetSerializerConfig(schemaConfig));

                    isInitialized = true;
                }
                else
                {
                    throw new StreamConfigException($"Configuration must inherited from ISchemaRegistryConfig for SchemaAvroSerDes<{typeof(T).Name}");
                }
            }
        }
 internal ProcessorContext(IStreamConfig configuration, IStateManager stateManager)
 {
     Configuration = configuration;
     States        = stateManager;
     SerDesContext = new SerDesContext(configuration);
 }