-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aggregates + RouteKeysConfig where the array of values does not work correctly #2248
Comments
Hello, Artyom! Yes, you have 2 requests because your downstream service returned 2 user items with the same ID which is |
Artyom, If you need consultation, our teammate will assist you. However, it would be better if you develop your own aggregator first, without a Complex Aggregation logic. |
No, no, you don't understand me. I have the following specified in json
This means that this request must be executed at the beginning. The response always comes from it.
This is what the controller looks like
So Ocelot should
Then I will get a response from the first request.
and the response from the second request
[ApiController]
}
|
🆗 Fair enough! Could you please debug the ProcessRouteWithComplexAggregation method to locate issue? |
I have debugged, attached screenshots of control values where value(userId) = 1, value(userId) = 2 It is noticeable that HttpContext stores the value value in TemplatePlaceholderNameAndValues at each iteration. The problem is that tPnv is a reference from HttpContext.items, and when you add Placeholder to tPnv, Placeholder is added to HttpContext, and each time the number of parameters with one userId key increases, although only the last value should be recorded. Most likely, only the first value (1) with one userId key per url is always sent. http://localhost:5001/users /{id} Simply addition of ToList() removes the problem because we are already working with another reference object. |
@ArtyomZhuravlyov Thank you for debugging. Do you intend to open a PR to fix this? @ggnaegi What do you think? Anyway, you will be key reviewer 😉 |
@ArtyomZhuravlyov @raman-m well, what we could do, it's just pass the |
@raman-m, @ggnaegi I think you know better how to do better. I think it would be better if you fix it yourself and you open a PR. I have little experience with this. And one more thing, why not work with a lot of parameters here?
For example, I want to pass two parameters to http://localhost:5001/users / and would like to specify "RouteKeysConfig": [
{
"RouteKey": "user",
"JsonPath": "$[*].userId",
"Parameter": "id"
},
{
"RouteKey": "user",
"JsonPath": "$[*].otherParameterId",
"Parameter": "otherParameter"
}
] Now because |
@ggnaegi Yes, why not? Why set limits? For example, I need to pass the following parameters to the second request And in my case, I can't get the necessary rfassetlocations by subdivisionId alone, I need the whole chain CompanyId -> rfmanufactureId -> subdivisionId. |
@ArtyomZhuravlyov Ok, let's check this. But first, fix the issue. |
@ArtyomZhuravlyov commented on Jan 15
Yes, my dear, we will address this ourselves: the bug has been accepted. We will assign the appropriate priority label based on our internal team capacity, as it appears you will not be contributing. |
OK, but you are asking for too much! This is a new feature proposal, and you are mixing both the new feature and the current bug. If you really want the new feature, please go to the official issue template and use it to propose the new feature and describe the new feature requirements completely. |
Let's discuss and plan this issue internally. |
Expected Behavior / New Feature
My json
I'm accessing the aggregating url:
http://localhost:5003/aggregateСommentUser
The first request occurs for
http://localhost:5002/comments
If my first query in the aggregation returns a response
Then when I request information about users, I should get a response.
And the requests themselves should look like this:
1.
http://localhost:5002/comments
2.
http://localhost:5001/users/1
3.
http://localhost:5001/users/2
Actual Behavior / Motivation for New Feature
I'm accessing the aggregating url:
http://localhost:5003/aggregateСommentUser
The first request occurs for http://localhost:5002/comments
my first query in the aggregation returns a response
I receive a response from the user service
Because my requests from Ocelot look like this:
1.
http://localhost:5002/comments
2.
http://localhost:5001/users/1
3.
http://localhost:5001/users/1
Link to the repository: https://github.com/ArtyomZhuravlyov/OcelotAggregate
Specifications
The text was updated successfully, but these errors were encountered: