MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / startProcessingProcessors

Method startProcessingProcessors

libminifi/src/core/ProcessGroup.cpp:141–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void ProcessGroup::startProcessingProcessors(const std::shared_ptr<TimerDrivenSchedulingAgent>& timeScheduler,
142 const std::shared_ptr<EventDrivenSchedulingAgent> &eventScheduler, const std::shared_ptr<CronDrivenSchedulingAgent> &cronScheduler) {
143 std::unique_lock<std::recursive_mutex> lock(mutex_);
144
145 std::set<std::shared_ptr<Processor> > failed_processors;
146
147 for (const auto &processor : failed_processors_) {
148 try {
149 logger_->log_debug("Starting %s", processor->getName());
150 switch (processor->getSchedulingStrategy()) {
151 case TIMER_DRIVEN:
152 timeScheduler->schedule(processor);
153 break;
154 case EVENT_DRIVEN:
155 eventScheduler->schedule(processor);
156 break;
157 case CRON_DRIVEN:
158 cronScheduler->schedule(processor);
159 break;
160 }
161 }
162 catch (const std::exception &e) {
163 logger_->log_error("Failed to start processor %s (%s): %s", processor->getUUIDStr(), processor->getName(), e.what());
164 failed_processors.insert(processor);
165 }
166 catch (...) {
167 logger_->log_error("Failed to start processor %s (%s)", processor->getUUIDStr(), processor->getName());
168 failed_processors.insert(processor);
169 }
170 }
171 failed_processors_ = std::move(failed_processors);
172
173 for (auto& processor : failed_processors_) {
174 try {
175 processor->onUnSchedule();
176 } catch (...) {
177 logger_->log_error("Exception occured during unscheduling processor: %s (%s)", processor->getUUIDStr(), processor->getName());
178 }
179 }
180
181 if (!onScheduleTimer_ && !failed_processors_.empty() && onschedule_retry_msec_ > 0) {
182 logger_->log_info("Retrying failed processors in %lld msec", onschedule_retry_msec_.load());
183 auto func = [this, eventScheduler, cronScheduler, timeScheduler]() {
184 this->startProcessingProcessors(timeScheduler, eventScheduler, cronScheduler);
185 };
186 onScheduleTimer_.reset(new utils::CallBackTimer(std::chrono::milliseconds(onschedule_retry_msec_), func));
187 onScheduleTimer_->start();
188 } else if (failed_processors_.empty() && onScheduleTimer_) {
189 onScheduleTimer_->stop();
190 }
191}
192
193void ProcessGroup::startProcessing(const std::shared_ptr<TimerDrivenSchedulingAgent>& timeScheduler, const std::shared_ptr<EventDrivenSchedulingAgent> &eventScheduler,
194 const std::shared_ptr<CronDrivenSchedulingAgent> &cronScheduler) {

Callers

nothing calls this directly

Calls 15

log_debugMethod · 0.80
getSchedulingStrategyMethod · 0.80
log_errorMethod · 0.80
log_infoMethod · 0.80
getNameMethod · 0.45
scheduleMethod · 0.45
getUUIDStrMethod · 0.45
whatMethod · 0.45
insertMethod · 0.45
onUnScheduleMethod · 0.45
emptyMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected