The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

395022 (2) [Avatar] Offline
Hi all.

I have trouble with example from paragraph 6.7. Created route filter is doing its request, but the final response is from old organization service. So there are 2 request.
I was debugging a bit Zuul and can't see any fragment of code responsible for stopping to process the message further. Zuul has its own list of route filters and filter defined in the example is added as first, but filters are processed one by one, so the response is from built-in route filter that make a call to old organization service.
Any idea how this is working?

Kind regards,
395022 (2) [Avatar] Offline
Looks I've solved this issue with two changes in SpecialRoutesFilter.

- first: I think the http client should not be closed, looking at SimpleHostRoutingFilter which seems to be the original zuul route filter - here is some complicated logic of replacing httpclient, but it is not closed directly after making a call
- second: after getting response I set RequestContext.getCurrentContext().setSendZuulResponse(false); to prevent SimpleHostRoutingFilter from making the call to the original service.

Of course I'm still not sure if this is desirable way of doing it and not only workaround.

Kind regards,
557915 (2) [Avatar] Offline

Can you provide the code example, where to put the below line,

I am trying by adding the above line just after the setResponse call in run method, also tried to not closing the httclient. Now the call is not happening to original org service but getting the empty response for org-new service.

Verified both zuul and org-new service not throwing an error. Please direct me what i am doing wrong here.