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

Method onTrigger

extensions/sql/processors/SQLProcessor.h:53–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 void onTrigger(const std::shared_ptr<core::ProcessContext>& context, const std::shared_ptr<core::ProcessSession>& session) override {
54 std::unique_lock<std::mutex> lock(onTriggerMutex_, std::try_to_lock);
55 if (!lock.owns_lock()) {
56 logger_->log_warn("'onTrigger' is called before previous 'onTrigger' call is finished.");
57 context->yield();
58 return;
59 }
60
61 try {
62 if (!connection_) {
63 connection_ = dbService_->getConnection();
64 }
65 static_cast<T*>(this)->processOnTrigger(*session);
66 } catch (std::exception& e) {
67 logger_->log_error("SQLProcessor: '%s'", e.what());
68 if (connection_) {
69 std::string exp;
70 if (!connection_->connected(exp)) {
71 logger_->log_error("SQLProcessor: Connection exception: %s", exp.c_str());
72 connection_.reset();
73 }
74 }
75 context->yield();
76 }
77 }
78
79 void notifyStop() override {
80 connection_.reset();

Callers

nothing calls this directly

Calls 9

log_warnMethod · 0.80
log_errorMethod · 0.80
connectedMethod · 0.80
c_strMethod · 0.80
yieldMethod · 0.45
getConnectionMethod · 0.45
processOnTriggerMethod · 0.45
whatMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected