cf-java-client icon indicating copy to clipboard operation
cf-java-client copied to clipboard

v2/info call getting triggered internally while creating CloudFoundryClient and consuming v3 api's

Open bhavinshah-mendix opened this issue 10 months ago • 0 comments

Hello,

Could someone assist me in grasping why the invocation of v3 API functions such as organizationsV3(), spacesV3(), or routesV3() etc., triggers the automatic invocation of v2/info when I create a CloudFoundryOperation client using CloudFoundryClient?

CloudFoundryClient Creation code:

cloudFoundryClient = ReactorCloudFoundryClient.builder()
        		.connectionContext(connectionContext)
                .tokenProvider(tokenProvider)
                .build();

OperationClient Creation Code:

cloudFoundryOperations = DefaultCloudFoundryOperations.builder()
                .cloudFoundryClient(cloudFoundryClient)
                .organization(StringUtils.EMPTY)
                .space(StringUtils.EMPTY)
                .build();

Fetching Organization:

ListOrganizationsRequest orgListRequest = ListOrganizationsRequest.builder().build();
ListOrganizationsResponse listOrganizationsResponse =  cloudFoundryClient.organizationsV3().list(orgListRequest).timeout(CF_REQUEST_TIMEOUT).block();

After investigation, I discovered that within _ReactorCloudFoundryClient.java, there's a checkCompatibility() method annotated with @PostConstruct, triggering the info() function. However, it remains uncertain whether this is the sole factor contributing to the observed behaviour.

looping @anthonydahanne , as I noticed your impressive contribution to the repository! Your dedication and expertise shine through in your work, so could help me :)

bhavinshah-mendix avatar Apr 15 '24 18:04 bhavinshah-mendix