Skip to content

Internals: Flow

Edison Wang edited this page May 19, 2016 · 2 revisions

Before Execution

  1. Request sent to EventService, the service will queue it on the requested Executor.

    • During this time, request can be cancelled.
  2. Executor executes this the Request.

    • During this time, request can no longer be cancelled.

During Execution

This flow is defined per request.

  1. If there are any dependencies, execute the dependencies in order.
    • if any of them emits a fatal failure, call OnCompletion and terminate with null result.
  2. If there are any requirements, check the requirements with the results from dependencies.
    • if any of the requirements are not satisfied, call OnCompletion and terminate with null result.
  3. Process the current action. (Generates processed result).
    • deliver the result.
    • if result is a fatal failure, call OnCompletion and terminate with this result.
  4. If there are any chained requests, execute them in order.
    • if any of them emits a fatal failure, call OnCompletion and terminate with processed result.
  5. Result will be delivered by the requesting process.

During Process

This flow is defined per Action type.

Action

  1. Call process() and return a result.

FullAction

  1. If cache is allowed, return the request from cache.
    • A Cache hit is defined by the request argument bundle match perfectly.
  2. preProcess() happens, it should return null on success, if non-null results returned, it will be treated as an error.
  3. process() happens and the result will be put in cache.

After Execution

This technically happens "during" execution.

Events (ActionResult) will be delivered to listeners via EventBus.

Clone this wiki locally