Iman Aliabdi
Iman Aliabdi

Reputation: 301

Calling API using Feign Client in a scheduler or staring request from kafka Listener got No thread-bound request found

I'm trying to use feign client in an spring boot project, everything works when starting the request from a controller class, but if start the request from an scheduler method or kafka listener, I get the following error:

No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.

I tried many available solutions such as using RequestContextFilter and RequestContextListener but nothing happens.

Spring boot version is: 2.3.3.RELEASE

feign-httpclient: 13.0

spring-cloud-starter-openfeign: 2.2.10.RELEASE

I'll be so thankful if somebody can provide an idea for resolving this issue.

Upvotes: 1

Views: 250

Answers (0)

Related Questions