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

Method OPCData2FlowFile

extensions/opc/src/fetchopc.cpp:218–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216 }
217
218 void FetchOPCProcessor::OPCData2FlowFile(const opc::NodeData& opcnode, const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
219 auto flowFile = session->create();
220 if (flowFile == nullptr) {
221 logger_->log_error("Failed to create flowfile!");
222 return;
223 }
224 for(const auto& attr: opcnode.attributes) {
225 flowFile->setAttribute(attr.first, attr.second);
226 }
227 if(opcnode.data.size() > 0) {
228 try {
229 FetchOPCProcessor::WriteCallback callback(opc::nodeValue2String(opcnode));
230 session->write(flowFile, &callback);
231 } catch (const std::exception& e) {
232 std::string browsename;
233 flowFile->getAttribute("Browsename", browsename);
234 logger_->log_info("Failed to extract data of OPC node %s: %s", browsename, e.what());
235 session->transfer(flowFile, Failure);
236 return;
237 }
238 }
239 session->transfer(flowFile, Success);
240 }
241
242} /* namespace processors */
243} /* namespace minifi */

Callers

nothing calls this directly

Calls 10

nodeValue2StringFunction · 0.85
log_errorMethod · 0.80
log_infoMethod · 0.80
createMethod · 0.45
setAttributeMethod · 0.45
sizeMethod · 0.45
writeMethod · 0.45
getAttributeMethod · 0.45
whatMethod · 0.45
transferMethod · 0.45

Tested by

no test coverage detected