We have a REST end point /startDeployment/{CustomerA}
which when executed for Customer A , do the following things :
Step 1. Create Space in Org
Step 2. Create Predix Services
Step 3. Deploy all the 5 micro-services
We are using the Java CF CLI APIs (cloud-foundry libraries) for this , like below :
org.cloudfoundry.client.lib.CloudFoundryClient
org.cloudfoundry.client.lib.CloudFoundryOperations
We are successfully able to deploy all 5 micro-services .
Now , the problem here is lets say , the deployment for Customer A is going on (lets say Executing Step 2) and now we try to do the deployment for Customer B ( /startDeployment/{CustomerA}
) in parallel .
The execution of the Customer A is then PAUSED
and deployment of Customer B STARTS
. Which causes conflicts .
Is there any way where we can have deployment using Java CF CLI APIs Parallely
in more than one Space . ?
@Siva Balan
Answer by Tom Turner · Mar 29, 2018 at 08:58 AM
It kind of sounds like the CF library has implemented some semaphore's because it's not thread safe.
Have you tried doing this in separate threads? For example, for your REST endpoint you pass in the variable {CustomerX}. Which seems like you are already doing that.
One way, if this is deployed to cloud foundry, is to create more instances. The load balancer will round robin and run in separate JVMs. Thus ensuring any library calls are not blocked by a 2nd thread.