Exemple #1
0
        private void BuildProcessorNode(IDictionary <string, IProcessor> processors, IDictionary <string, IStateStore> stateStores, IProcessorNodeFactory factory, IProcessor processor, TaskId taskId)
        {
            foreach (string predecessor in factory.Previous)
            {
                IProcessor predecessorNode = processors[predecessor];
                predecessorNode.AddNextProcessor(processor);
            }

            foreach (string stateStoreName in factory.StateStores)
            {
                if (!stateStores.ContainsKey(stateStoreName))
                {
                    if (stateFactories.ContainsKey(stateStoreName))
                    {
                        StateStoreFactory stateStoreFactory = stateFactories[stateStoreName];

                        if (stateStoreFactory.LoggingEnabled && !storesToTopics.ContainsKey(stateStoreName))
                        {
                            string changelogTopic = ProcessorStateManager.StoreChangelogTopic(applicationId, stateStoreName);
                            storesToTopics.Add(stateStoreName, changelogTopic);
                        }

                        stateStores.Add(stateStoreName, stateStoreFactory.Build(taskId));
                    }
                    else
                    {
                        stateStores.Add(stateStoreName, GlobalStateStores[stateStoreName]);
                    }
                }
            }
        }
 public ProcessorStateManager(TaskId taskId, TopicPartition partition)
 {
     this.log       = Logger.GetLogger(typeof(ProcessorStateManager));
     this.logPrefix = $"stream-task[{taskId.Topic}|{taskId.Partition}] ";
     Partition      = partition;
 }
 public abstract T CreateTask(IConsumer <byte[], byte[]> consumer, TaskId id, IEnumerable <TopicPartition> partition);
Exemple #4
0
        private void BuildProcessorNode(IDictionary <string, IProcessor> processors, IDictionary <string, IStateStore> stateStores, IProcessorNodeFactory factory, IProcessor processor, TaskId taskId)
        {
            foreach (string predecessor in factory.Previous)
            {
                IProcessor predecessorNode = processors[predecessor];
                predecessorNode.AddNextProcessor(processor);
            }

            foreach (string stateStoreName in factory.StateStores)
            {
                if (!stateStores.ContainsKey(stateStoreName))
                {
                    if (stateFactories.ContainsKey(stateStoreName))
                    {
                        StateStoreFactory stateStoreFactory = stateFactories[stateStoreName];

                        // TODO : changelog topic (remember the changelog topic if this state store is change-logging enabled)
                        stateStores.Add(stateStoreName, stateStoreFactory.Build(taskId));
                    }
                    else
                    {
                        stateStores.Add(stateStoreName, GlobalStateStores[stateStoreName]);
                    }
                }
            }
        }
Exemple #5
0
 public abstract T CreateTask(IConsumer <byte[], byte[]> consumer, TaskId id, TopicPartition partition);