| 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 */ |
nothing calls this directly
no test coverage detected