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

Method route

extensions/http-curl/processors/InvokeHTTP.cpp:397–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397void InvokeHTTP::route(const std::shared_ptr<core::FlowFile> &request, const std::shared_ptr<core::FlowFile> &response, const std::shared_ptr<core::ProcessSession> &session,
398 const std::shared_ptr<core::ProcessContext> &context, bool isSuccess, int64_t statusCode) {
399 // check if we should yield the processor
400 if (!isSuccess && request == nullptr) {
401 context->yield();
402 }
403
404 // If the property to output the response flowfile regardless of status code is set then transfer it
405 bool responseSent = false;
406 if (always_output_response_ && response != nullptr) {
407 logger_->log_debug("Outputting success and response");
408 session->transfer(response, RelResponse);
409 responseSent = true;
410 }
411
412 // transfer to the correct relationship
413 // 2xx -> SUCCESS
414 if (isSuccess) {
415 // we have two flowfiles to transfer
416 if (request != nullptr) {
417 session->transfer(request, Success);
418 }
419 if (response != nullptr && !responseSent) {
420 logger_->log_debug("Outputting success and response");
421 session->transfer(response, RelResponse);
422 }
423 // 5xx -> RETRY
424 } else if (statusCode / 100 == 5) {
425 if (request != nullptr) {
426 session->penalize(request);
427 session->transfer(request, RelRetry);
428 }
429 // 1xx, 3xx, 4xx -> NO RETRY
430 } else {
431 if (request != nullptr) {
432 if (penalize_no_retry_) {
433 session->penalize(request);
434 }
435 session->transfer(request, RelNoRetry);
436 }
437 }
438}
439
440} /* namespace processors */
441} /* namespace minifi */

Callers

nothing calls this directly

Calls 4

log_debugMethod · 0.80
yieldMethod · 0.45
transferMethod · 0.45
penalizeMethod · 0.45

Tested by

no test coverage detected