Hi Nik,
If I pass more than 70 Features list in doGet method, it fails stating URL is too long. looks like there is limitation on doGet requests. So I tried doPost I get
Exception in thread "main" java.io.IOException: HTTP/1.1 405 Could not find web service for ?/HierarchicalRequirement? using request method ?POST?. However a service does exist at that path using method(s) ?GET?.Exception in thread "main" java.io.IOException: HTTP/1.1 405 Could not find web service for ?/HierarchicalRequirement? using request method ?POST?. However a service does exist at that path using method(s) ?GET?. at com.rallydev.rest.client.HttpClient.executeRequest(HttpClient.java:163)
Is there any way, I can pull the hierarchical response by passing list of features? this is my functional need. (without worrying for pagination).
Here is my code snippet for doPost.
public String getRallyHierarchy(List<String> featureApplicableList) throws IOException {
RallyRestApi rallyRestApi = getRallyConnection();
System.out.println(" Total List of Features :-"+featureApplicableList.size());
String query = "";
String initialQuery = "start=1&pagesize=2000&query=";
String queryBraces = "";
int i = 0;
int len = featureApplicableList.size();
for (String featureName : featureApplicableList) {
query += "(Feature = \"/portfolioitem/feature/" + featureName + "\"" + ")";
if (i != 0) {
queryBraces += "(";
query += ")";
}
if (i < len - 1)
query += " OR ";
i++;
}
String sParams = URLEncoder.encode("FormattedID,ObjectID,Name,Feature,Iteration,PlanEstimate,ScheduleState,Project,StartDate,EndDate,Blocked,BlockedReason,DisplayColor,Release,Predecessors,DragAndDropRank,PredecessorNotScheduled,PredecessorScheduledInSameOrLaterIteration,Defects,ReleaseDate,ReleaseStartDate");
String sVar = "&includePermissions=true&compact=true&workspace=";
String finalQuery = initialQuery + queryBraces + URLEncoder.encode(query, "UTF-8") + "&fetch=" + sParams + sVar + URLEncoder.encode("/workspace/" + AXP_WORKSPACE_ID) + "&_method=GET&key=" + sessionID;
finalQuery = finalQuery.replaceAll("%28", "(");
finalQuery = finalQuery.replaceAll("%29", ")");
finalQuery = finalQuery.replaceAll("\\+", "%20");
System.out.println(" WSAPIURL : "+rallyRestApi.getClient().getWsapiUrl()+"/HierarchicalRequirement?slug=%2Freleasetracking?");
System.out.println("finalQuery: " + finalQuery);
String response = rallyRestApi.getClient().doPost("/HierarchicalRequirement?slug=%2Freleasetracking?",finalQuery);
Original Message:
Sent: 03-23-2020 07:01 AM
From: Nik Antonelli
Subject: Getting Connection still allocated.
Hi, @ATUL RAY
There might be some tips here: https://stackoverflow.com/questions/14866362/invalid-use-of-basicclientconnmanager-connection-still-allocated
It looks like you have an issue with threads in Java code rather than the Restful API of Rally.
I think there may be two parts to the follow-on questions you are asking:
1. Capability of the Rest API on Rally.
I have tested up to 2048 concurrent requests to Rally from the same program using worker threads making XmlHttpRequest calls. I didn't go any higher as it consumed all the processing power and memory on my test laptop to set up the threads, execute the calls and handle the results. The only limitation on accesses to our system are ones set by normal networking protocols. However, if you have a runaway piece of code (mishandled loop , for example), this may trigger an alarm and the username (via the APIKey) making those calls will get blocked. Contacting our support is the only way to reverse that.
2. Concurrency of accessing items in the Rally databases.
When you are reading from work items in Rally, there are no issues with concurrency. When you try to write back and modify, then you can get errors returned that indicate that the data you are using to make the write-back is stale. This can happen with two concurrent writes to the same artefact. The other impact of concurrency is if you try to add a Feature as a parent to two separate User Stories in two separate threads. The data set in one of the threads can become obsolete after the other thread makes a successful write. The API detects this and will return an error. The only route forward from that point is to re-read the parent artefact and re-make the updates. It is possible to structure code so that this is avoided.
If I didn't answer your questions, please let me know.
------------------------------
Nik
Ask me a question, I'm All Ears!
Rally Sales Engineer
Rally Software
Original Message:
Sent: 03-21-2020 04:23 PM
From: ATUL RAY
Subject: Getting Connection still allocated.
Hi
We would like to know how to get rid of this exception. Please route this question to Java team from your group.
java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
at org.apache.http.util.Asserts.check(Asserts.java:34)
at org.apache.http.impl.conn.BasicClientConnectionManager.getConnection(BasicClientConnectionManager.java:163)
at org.apache.http.impl.conn.BasicClientConnectionManager$1.getConnection(BasicClientConnectionManager.java:145)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:422)
Here is my code how I am making singleton connection
restApi = new RallyRestApi(new URI(rallyUrl), sessionID);
restApi.setProxy(new URI(rallyProxy));
rallyRestApi = restApi;
We are trying with one rallyRestAPI object. Looks like there are some concurrent users who are hitting due to which we have got following issue.
Kindly advise on following !!
Let us know how many concurrent users, can use 1 RallyRestAPI object ? . I can setup that in my code.
If there is better way to connect to rally ?
After how many connections you can block the API key? if it gets blocked what is procedure to get it unblocked.
Let us know if you have any dedicated support team, where we can reach for questions for corporate teams.