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

Method write

libminifi/src/core/ProcessSession.cpp:213–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void ProcessSession::write(const std::shared_ptr<core::FlowFile> &flow, OutputStreamCallback *callback) {
214 std::shared_ptr<ResourceClaim> claim = content_session_->create();
215
216 try {
217 uint64_t startTime = utils::timeutils::getTimeMillis();
218 std::shared_ptr<io::BaseStream> stream = content_session_->write(claim);
219 // Call the callback to write the content
220 if (nullptr == stream) {
221 throw Exception(FILE_OPERATION_EXCEPTION, "Failed to open flowfile content for write");
222 }
223 if (callback->process(stream) < 0) {
224 throw Exception(FILE_OPERATION_EXCEPTION, "Failed to process flowfile content");
225 }
226
227 flow->setSize(stream->size());
228 flow->setOffset(0);
229 flow->setResourceClaim(claim);
230
231 stream->close();
232 std::string details = process_context_->getProcessorNode()->getName() + " modify flow record content " + flow->getUUIDStr();
233 uint64_t endTime = utils::timeutils::getTimeMillis();
234 provenance_report_->modifyContent(flow, details, endTime - startTime);
235 } catch (std::exception &exception) {
236 logger_->log_debug("Caught Exception %s", exception.what());
237 throw;
238 } catch (...) {
239 logger_->log_debug("Caught Exception during process session write");
240 throw;
241 }
242}
243
244void ProcessSession::append(const std::shared_ptr<core::FlowFile> &flow, OutputStreamCallback *callback) {
245 std::shared_ptr<ResourceClaim> claim = flow->getResourceClaim();

Callers 3

appendMethod · 0.45
importFromMethod · 0.45
importMethod · 0.45

Calls 15

getTimeMillisFunction · 0.85
ExceptionClass · 0.85
setSizeMethod · 0.80
setOffsetMethod · 0.80
setResourceClaimMethod · 0.80
getProcessorNodeMethod · 0.80
log_debugMethod · 0.80
createMethod · 0.45
processMethod · 0.45
sizeMethod · 0.45
closeMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected