szaszm commented on code in PR #1383:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1383#discussion_r954861563
##########
extensions/http-curl/processors/InvokeHTTP.h:
##########
@@ -127,52 +130,37 @@ class InvokeHTTP : public core::Processor {
EXTENSIONAPI static constexpr const char* STATUS_CODE =
"invokehttp.status.code";
EXTENSIONAPI static constexpr const char* STATUS_MESSAGE =
"invokehttp.status.message";
- EXTENSIONAPI static constexpr const char* RESPONSE_BODY =
"invokehttp.response.body";
EXTENSIONAPI static constexpr const char* REQUEST_URL =
"invokehttp.request.url";
EXTENSIONAPI static constexpr const char* TRANSACTION_ID =
"invokehttp.tx.id";
- EXTENSIONAPI static constexpr const char* REMOTE_DN = "invokehttp.remote.dn";
- EXTENSIONAPI static constexpr const char* EXCEPTION_CLASS =
"invokehttp.java.exception.class";
- EXTENSIONAPI static constexpr const char* EXCEPTION_MESSAGE =
"invokehttp.java.exception.message";
- void onTrigger(const std::shared_ptr<core::ProcessContext> &context, const
std::shared_ptr<core::ProcessSession> &session) override;
+ void onTrigger(const std::shared_ptr<core::ProcessContext>& context, const
std::shared_ptr<core::ProcessSession>& session) override;
void initialize() override;
- void onSchedule(const std::shared_ptr<core::ProcessContext> &context, const
std::shared_ptr<core::ProcessSessionFactory> &sessionFactory) override;
+ void onSchedule(const std::shared_ptr<core::ProcessContext>& context, const
std::shared_ptr<core::ProcessSessionFactory>& sessionFactory) override;
private:
- /**
- * Routes the flowfile to the proper destination
- * @param request request flow file record
- * @param response response flow file record
- * @param session process session
- * @param context process context
- * @param isSuccess success code or not
- * @param statuscode http response code.
- */
- void route(const std::shared_ptr<core::FlowFile> &request, const
std::shared_ptr<core::FlowFile> &response, const
std::shared_ptr<core::ProcessSession> &session,
- const std::shared_ptr<core::ProcessContext> &context, bool
is_success, int64_t status_code);
- bool shouldEmitFlowFile() const;
+ void route(const std::shared_ptr<core::FlowFile>& request, const
std::shared_ptr<core::FlowFile>& response, const
std::shared_ptr<core::ProcessSession>& session,
+ const std::shared_ptr<core::ProcessContext>& context, bool
is_success, int64_t status_code);
+ static bool shouldEmitFlowFile(minifi::extensions::curl::HTTPClient& client);
+ void onTriggerWithClient(const std::shared_ptr<core::ProcessContext>&
context, const std::shared_ptr<core::ProcessSession>& session,
minifi::extensions::curl::HTTPClient& client);
[[nodiscard]] bool appendHeaders(const core::FlowFile& flow_file,
/*std::invocable<std::string, std::string>*/ auto append_header);
- std::shared_ptr<minifi::controllers::SSLContextService> ssl_context_service_;
- std::string method_;
- std::string url_;
- bool date_header_include_{true};
+
+ void setupMembersFromProperties(const core::ProcessContext& context);
+ std::unique_ptr<minifi::extensions::curl::HTTPClient>
createHTTPClientFromPropertiesAndMembers(const core::ProcessContext& context)
const;
+
std::optional<utils::Regex> attributes_to_send_;
- std::chrono::milliseconds connect_timeout_ms_{20000};
- std::chrono::milliseconds read_timeout_ms_{20000};
- // attribute in which response body will be added
- std::string put_attribute_name_;
+
+ std::optional<std::string> put_response_body_in_attribute_;
bool always_output_response_{false};
- std::string content_type_;
bool use_chunked_encoding_{false};
bool penalize_no_retry_{false};
- // disabling peer verification makes susceptible for MITM attacks
- bool disable_peer_verification_{false};
- utils::HTTPProxy proxy_;
- bool follow_redirects_{true};
bool send_body_{true};
+
InvalidHTTPHeaderFieldHandlingOption
invalid_http_header_field_handling_strategy_;
+
std::shared_ptr<core::logging::Logger>
logger_{core::logging::LoggerFactory<InvokeHTTP>::getLogger()};
+
gsl::not_null<std::shared_ptr<utils::ResourceQueue<extensions::curl::HTTPClient>>>
client_queue_ = gsl::make_not_null(
+
utils::ResourceQueue<extensions::curl::HTTPClient>::create(getMaxConcurrentTasks(),
logger_));
Review Comment:
A dummy object with incorrect data is easier to misuse, than null. I agree.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]