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

Method get

libminifi/src/core/ProcessSession.cpp:912–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

910}
911
912std::shared_ptr<core::FlowFile> ProcessSession::get() {
913 std::shared_ptr<Connectable> first = process_context_->getProcessorNode()->pickIncomingConnection();
914
915 if (first == nullptr) {
916 logger_->log_trace("Get is null for %s", process_context_->getProcessorNode()->getName());
917 return nullptr;
918 }
919
920 std::shared_ptr<Connection> current = std::static_pointer_cast<Connection>(first);
921
922 do {
923 std::set<std::shared_ptr<core::FlowFile> > expired;
924 std::shared_ptr<core::FlowFile> ret = current->poll(expired);
925 if (!expired.empty()) {
926 // Remove expired flow record
927 for (const auto& record : expired) {
928 std::stringstream details;
929 details << process_context_->getProcessorNode()->getName() << " expire flow record " << record->getUUIDStr();
930 provenance_report_->expire(record, details.str());
931 // there is no rolling back expired FlowFiles
932 if (record->isStored() && process_context_->getFlowFileRepository()->Delete(record->getUUIDStr())) {
933 record->setStoredToRepository(false);
934 }
935 }
936 }
937 if (ret) {
938 // add the flow record to the current process session update map
939 ret->setDeleted(false);
940 std::shared_ptr<FlowFile> snapshot = std::make_shared<FlowFileRecord>();
941 *snapshot = *ret;
942 logger_->log_debug("Create Snapshot FlowFile with UUID %s", snapshot->getUUIDStr());
943 utils::Identifier uuid = ret->getUUID();
944 _updatedFlowFiles[uuid] = {ret, snapshot};
945 auto flow_version = process_context_->getProcessorNode()->getFlowIdentifier();
946 if (flow_version != nullptr) {
947 ret->setAttribute(SpecialFlowAttribute::FLOW_ID, flow_version->getFlowId());
948 }
949 return ret;
950 }
951 current = std::static_pointer_cast<Connection>(process_context_->getProcessorNode()->pickIncomingConnection());
952 } while (current != nullptr && current != first);
953
954 return nullptr;
955}
956
957void ProcessSession::flushContent() {
958 content_session_->commit();

Callers 15

processMethod · 0.45
extractPrivateKeyFunction · 0.45
commitMethod · 0.45
persistMethod · 0.45
onTriggerMethod · 0.45
initializeMethod · 0.45
initializeMethod · 0.45
initializeMethod · 0.45
StreamFactoryMethod · 0.45

Calls 15

getProcessorNodeMethod · 0.80
log_traceMethod · 0.80
pollMethod · 0.80
expireMethod · 0.80
isStoredMethod · 0.80
setStoredToRepositoryMethod · 0.80
setDeletedMethod · 0.80
log_debugMethod · 0.80
getNameMethod · 0.45
emptyMethod · 0.45
getUUIDStrMethod · 0.45

Tested by

no test coverage detected