Rest service at one instance of Cloud Foundry at one point of time

Viewed 296

I have one Rest service running in PCF.It might take 10-15mins to complete.PCF app is configured to run on multiple instances.

I want to make sure at a single point of time,that Rest service to run only in one instance. e.g: if the Rest service running in one instance and I try to call the same service multiple times then it should not be taken by any other instance, rather it should wait till it's completion and then it can run in any other or same instance.

Kindly suggest some best practices to this.Thanks in advance.

1 Answers

This is a prime use case for a message queue. Have any app accept the request and add it to the queue, then a free listener in any app can consume the message. If you are scaling a lot and it's a intensive task it might even be recommendable to split the produce and consumer into separate apps, so a intensive consumer doesn't make you api unresponsive

Related