Ocelot icon indicating copy to clipboard operation
Ocelot copied to clipboard

How to define multiple DownstreamPathTemplates to work for one UpstreamPathTemplate

Open fdevGit opened this issue 2 years ago • 3 comments

Hello, quick question. How to set up an incoming request to redirect to more than one endpoint

I'm thinking something like this, I will meet at separate endpoints for both the function and the counter of a request.

Regards !

fdevGit avatar May 06 '22 11:05 fdevGit

@TomPallister

fdevGit avatar May 06 '22 11:05 fdevGit

I thought it should be at the load balancer level

ocelot --> loadbalancer --> instance1
                       |--> instance2
                       |--> instance3

bwn-z avatar May 06 '22 12:05 bwn-z

@bwn-z load balancer only provides routing to one endpoint. I want to forward one incoming request to two different endpoints

fdevGit avatar May 09 '22 07:05 fdevGit

@fdevGit Just want to hit two enpoints means? you can use HttpClient from polly libraray and in same controller you can call two endpoints. Ocelot is api gateway, these things are not part of gateway instead you need your backend logic for it.

@ggnaegi @raman-m I don't think any action needed here, we can close if answer is right.

ks1990cn avatar Oct 11 '23 21:10 ks1990cn

@fdevGit You could implement your own delegating handler https://ocelot.readthedocs.io/en/latest/features/delegatinghandlers.html and call the counter endpoint from there with HttpClient.

ggnaegi avatar Oct 11 '23 22:10 ggnaegi

@ggnaegi I have question here: if anyone add some time consuming logic in SendAsync method, will it slow down application startup time or any time for request to reach controller level of same api?

ks1990cn avatar Oct 11 '23 22:10 ks1990cn