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

Method onSchedule

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

Source from the content-addressed store, hash-verified

168}
169
170void InvokeHTTP::onSchedule(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSessionFactory>& /*sessionFactory*/) {
171 if (!context->getProperty(Method.getName(), method_)) {
172 logger_->log_debug("%s attribute is missing, so default value of %s will be used", Method.getName(), Method.getValue());
173 return;
174 }
175
176 if (!context->getProperty(URL.getName(), url_)) {
177 logger_->log_debug("%s attribute is missing, so default value of %s will be used", URL.getName(), URL.getValue());
178 return;
179 }
180
181 uint64_t valInt;
182 std::string timeoutStr;
183 if (context->getProperty(ConnectTimeout.getName(), timeoutStr)
184 && core::Property::getTimeMSFromString(timeoutStr, valInt)) {
185 connect_timeout_ms_ = std::chrono::milliseconds(valInt);
186 } else {
187 logger_->log_debug("%s attribute is missing, so default value of %s will be used", ConnectTimeout.getName(), ConnectTimeout.getValue());
188 return;
189 }
190
191 std::string contentTypeStr;
192 if (context->getProperty(ContentType.getName(), contentTypeStr)) {
193 content_type_ = contentTypeStr;
194 }
195
196 timeoutStr.clear();
197 if (context->getProperty(ReadTimeout.getName(), timeoutStr)
198 && core::Property::getTimeMSFromString(timeoutStr, valInt)) {
199 read_timeout_ms_ = std::chrono::milliseconds(valInt);
200 } else {
201 logger_->log_debug("%s attribute is missing, so default value of %s will be used", ReadTimeout.getName(), ReadTimeout.getValue());
202 }
203
204 std::string dateHeaderStr;
205 if (!context->getProperty(DateHeader.getName(), dateHeaderStr)) {
206 logger_->log_debug("%s attribute is missing, so default value of %s will be used", DateHeader.getName(), DateHeader.getValue());
207 }
208
209 date_header_include_ = utils::StringUtils::StringToBool(dateHeaderStr, date_header_include_);
210
211 if (!context->getProperty(PropPutOutputAttributes.getName(), put_attribute_name_)) {
212 logger_->log_debug("%s attribute is missing, so default value of %s will be used", PropPutOutputAttributes.getName(), PropPutOutputAttributes.getValue());
213 }
214
215 if (!context->getProperty(AttributesToSend.getName(), attribute_to_send_regex_)) {
216 logger_->log_debug("%s attribute is missing, so default value of %s will be used", AttributesToSend.getName(), AttributesToSend.getValue());
217 }
218
219 std::string always_output_response = "false";
220 if (!context->getProperty(AlwaysOutputResponse.getName(), always_output_response)) {
221 logger_->log_debug("%s attribute is missing, so default value of %s will be used", AlwaysOutputResponse.getName(), AlwaysOutputResponse.getValue());
222 }
223
224 utils::StringUtils::StringToBool(always_output_response, always_output_response_);
225
226 std::string penalize_no_retry = "false";
227 if (!context->getProperty(PenalizeOnNoRetry.getName(), penalize_no_retry)) {

Callers 1

Calls 9

getTimeMSFromStringFunction · 0.85
IsNullOrEmptyFunction · 0.85
log_debugMethod · 0.80
getPropertyMethod · 0.45
getNameMethod · 0.45
getValueMethod · 0.45
clearMethod · 0.45
getControllerServiceMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected