Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

handlehttprequest / handlehttpresponse error when run more than 1 thread

avatar
Expert Contributor

I used handlehttprequest / handlehttpresponse: when i got a http request, then call 2 other apis at same time to get result, then merge 2 api result. if I run this service at 1 thread, it is ok, but got 2 errors when I run it via more than 1 thread:

1. because FlowFile did not have an 'http.context.identifier' attribute

2. Failed to respond to HTTP request for StandardFlowFileRecord because FlowFile had an 'http.context.identifier' attribute of but could not find an HTTP Response Object for this identifier

any suggestion? thanks in advance.

1 ACCEPTED SOLUTION

avatar
Super Mentor
@boyer

It may be helpful to see your dataflow to completely understand what you are doing.

When you say you "call 2 other apis at the same time", does that mean you are forking the success relationship from the HandleHttpRequest to two downstream processors? Then you are taking the successes from those processors and merging them back together into a single FlowFile before sending to the HandleHttpResponse processor?

Assuming the above is true, how do you have your mergeContent processor configured?

1. I would suggest you use the "http.context.identifier" as the "correlation Attribute Identifier" so that only FlowFiles originating form the same handleHttpRequest are merged together.

2. I also suggest setting "attribute strategy" to "Keep all unique attributes". (if 'Keep All Unique Attributes' is selected, any attribute on any FlowFile that gets bundled will be kept unless its value conflicts with the value from another FlowFile. ) This will be useful if your two intermediate processors set any unique attributes you want to keep on the resulting merged FlowFile.

You also want to make sure that your FlowFile makes it from the Request to Response before the configured expiration in your "StandardHttpContextMap" controller service.

Thanks,

Matt

View solution in original post

4 REPLIES 4

avatar
Super Mentor
@boyer

It may be helpful to see your dataflow to completely understand what you are doing.

When you say you "call 2 other apis at the same time", does that mean you are forking the success relationship from the HandleHttpRequest to two downstream processors? Then you are taking the successes from those processors and merging them back together into a single FlowFile before sending to the HandleHttpResponse processor?

Assuming the above is true, how do you have your mergeContent processor configured?

1. I would suggest you use the "http.context.identifier" as the "correlation Attribute Identifier" so that only FlowFiles originating form the same handleHttpRequest are merged together.

2. I also suggest setting "attribute strategy" to "Keep all unique attributes". (if 'Keep All Unique Attributes' is selected, any attribute on any FlowFile that gets bundled will be kept unless its value conflicts with the value from another FlowFile. ) This will be useful if your two intermediate processors set any unique attributes you want to keep on the resulting merged FlowFile.

You also want to make sure that your FlowFile makes it from the Request to Response before the configured expiration in your "StandardHttpContextMap" controller service.

Thanks,

Matt

avatar
Expert Contributor

I use the "http.context.identifier" as the "correlation Attribute Identifier", but got 2 error:

2. Failed to respond to HTTP request for StandardFlowFileRecord because FlowFile had an 'http.context.identifier' attribute of but could not find an HTTP Response Object for this identifier

avatar
Expert Contributor

I upload the template, I test 8013 port via soapui with multiple thread.

I cannot use the "http.context.identifier" as the "correlation Attribute Identifier", because I need use fltDate field.

hx.xml

avatar
New Contributor

@Matt Clarke , @boyer : I am also facing similar issue. In my case workflow is something like HandleHttpRequest -> InvokeHTTP -> output port -> goes to custom processor in different process group which has only one property setup -> input port -> HandleHttpResponse, I configured same StandardHttpContextMap in both HandleHttpRequest and HandleHttpResponse processors; how should I deal with this error with http.context.identifier in HandleHttpResponse processor? Any help is appreciated...