| 244 | } |
| 245 | |
| 246 | void RemoteProcessorGroupPort::onTrigger(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) { |
| 247 | logger_->log_trace("On trigger %s", getUUIDStr()); |
| 248 | if (!transmitting_) { |
| 249 | return; |
| 250 | } |
| 251 | |
| 252 | RPGLatch count; |
| 253 | |
| 254 | std::string value; |
| 255 | |
| 256 | logger_->log_trace("On trigger %s", getUUIDStr()); |
| 257 | |
| 258 | std::unique_ptr<sitetosite::SiteToSiteClient> protocol_ = nullptr; |
| 259 | try { |
| 260 | logger_->log_trace("get protocol in on trigger"); |
| 261 | protocol_ = getNextProtocol(); |
| 262 | |
| 263 | if (!protocol_) { |
| 264 | logger_->log_info("no protocol, yielding"); |
| 265 | context->yield(); |
| 266 | return; |
| 267 | } |
| 268 | |
| 269 | if (!protocol_->transfer(direction_, context, session)) { |
| 270 | logger_->log_warn("protocol transmission failed, yielding"); |
| 271 | context->yield(); |
| 272 | } |
| 273 | |
| 274 | returnProtocol(std::move(protocol_)); |
| 275 | return; |
| 276 | } catch (const minifi::Exception &) { |
| 277 | context->yield(); |
| 278 | session->rollback(); |
| 279 | } catch (...) { |
| 280 | context->yield(); |
| 281 | session->rollback(); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | std::pair<std::string, int> RemoteProcessorGroupPort::refreshRemoteSite2SiteInfo() { |
| 286 | if (nifi_instances_.empty()) |