Skip to content

v3 asynchronous endpoint flow

Davis W. Frank edited this page Jun 28, 2018 · 7 revisions

Using AppApplyManifest as an example:

Overview

  1. hit endpoint /apply_manifest
  2. retrieve message from params
  3. validations on message
  4. fetch models required —> the resource, app, and others (space, org)
  5. raise errors if the resource is not found or if user is not authorized
  6. initialize the action we want and pass it to the job
  7. record an audit event
  8. enqueue the job
    • this enqueues it in the Delayed::Job table, possibly with a timeout, run by the worker process on the scheduler VM —> in contrast to jobs run inline/immediately, which would be run on the worker processes on the API VM
  9. build the url using the job guid and return that to the user

Action

  1. get the model needed - App, in this case
  2. apply side effects - apply all process updates and scales
  3. update the model - AppUpdate.update
    • go into a transaction
    • update the resource
    • save
    • record event as necessary
  4. apply any changes to associated models, eg.
    • patch environment variables
    • create service bindings if there are services on the message
  5. return the modified model
Clone this wiki locally