I have an API gateway using the declarative Http client and trying to pass the route parameter to the other microservice application as below
@Client(id="feteBirdProduct", path = "/sub-category")
public interface ISubCategoryClient extends ISubCategoryOperation{
}
The path on the @Client path = "/sub-category"
is this correct for this URL http://localhost:8081/60236833af7a1d49478d2bef/sub-category
The Api Gateway controller
@Controller("/api/${api.version:v1}/{categoryId}/sub-category")
public class ApiGatewaySubCategoryController implements ISubCategoryOperation{
private final ISubCategoryClient iSubCategoryClient;
public ApiGatewaySubCategoryController(ISubCategoryClient iSubCategoryClient) {
this.iSubCategoryClient = iSubCategoryClient;
}
@Override
public Maybe<?> get(@ValidObjectId @NotBlank String categoryId) {
return this.iSubCategoryClient.get(categoryId);
}
}
ISubCategoryOperation
@Get
@Secured(SecurityRule.IS_ANONYMOUS)
Maybe<?> get(@Parameter(description="Category id") @ValidObjectId @NotNull String categoryId);
Implementation in the other microservice
@Controller("/{categoryId}/sub-category")
public class SubCategoryController implements ISubCategoryOperation {
@Override
public Maybe<?> get(String categoryId) {
return iSubCategoryManager.find(categoryId);
}
}
However, on the below CURL
curl -X GET "http://localhost:8080/api/v1/60236833af7a1d49478d2bef/sub-category" -H "accept: application/json"
The end point is never hit, what I am missing ?
The HTTP client logs
DEBUG i.m.h.client.netty.DefaultHttpClient - Sending HTTP GET to http://localhost:8081/sub-category
The HTTP request should be http://localhost:8081/60236833af7a1d49478d2bef /sub-category