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]);
                    }
                }
            }
        }
Ejemplo n.º 2
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]);
                    }
                }
            }
        }