Open smfaizalkhan opened 4 years ago
@chemdrew Can you let me know if there is a way to combine multiple request queries and send it across the WIRE as single request.
Right now i'm using as below.
portFolioRequestEntity = GraphQLRequestEntity.Builder()
.url(portFolioOverViewProperties.getConnectionUrl())
.request(PortFolioOverView.class).headers(headers)
.arguments(
new Arguments("portfolioOverview", new Argument("id", PORTFOLIO_ID)))
.build();
log.debug("requestEntity is {}", portFolioRequestEntity.getRequest());
universeRequestEntity = GraphQLRequestEntity.Builder()
.url(portFolioOverViewProperties.getConnectionUrl())
.request(UniverseMeta.class).headers(headers)
.build();
log.debug("requestEntity is {}", universeRequestEntity.getRequest());
String portFolioOverviewReq = getRequestEntityAsString(portFolioRequestEntity);
log.debug("portFolioOverviewReq" + portFolioOverviewReq);
String universeReq = getRequestEntityAsString(universeRequestEntity);
log.debug("universeReq" + universeReq);
String portFolioSummaryReq = "{" + portFolioOverviewReq
+ universeReq + "}";
log.debug("combinedRequest is {}", portFolioSummaryReq);
portFolioSummaryRequestEntity = GraphQLRequestEntity.Builder()
.url(portFolioOverViewProperties.getConnectionUrl())
.request(portFolioSummaryReq).headers(headers)
.build();
private String getRequestEntityAsString(GraphQLRequestEntity graphQLRequestEntity) {
String requestEntityAsString = graphQLRequestEntity.getRequest().trim().replaceAll("query", "");
return requestEntityAsString.substring(requestEntityAsString.indexOf('{') + 1, requestEntityAsString.length() - 1);
}
Is there any other better way to achieve it?
Hi @chemdrew, @realityforge
I have been using this tool for Our Application,We have a requirment to send mulitple queries in Single Reques
}
On debugging found that the request has param for only one class
public GraphQLRequestEntity.RequestBuilder request(Class clazz) { this.clazz = clazz; return this; }
Is it possible to have an OverLoaded Method ,taking multiple params like var args or any colletion
public GraphQLRequestEntity.RequestBuilder request(Class ... clazz)