Skip to content

05. Tasks

Roger Zaragoza edited this page Nov 11, 2016 · 2 revisions

Tasks

Task objects implement a RPC paradigm. Multiple task.pull calls can be waiting for tasks on a path.

When a task is sent with a task.push to that path, one of the pulls receive the task and starts resolving it.

The task must result in a task.result call indicating everything went good or a task.error call indicating the error.

A Task is JSON structure interchanged between two parties during an RPC exchange. It has the following structure:

{
  "Path": "nexus.demo.",
  "Method": "hello_world",
  "Params": {},
  "Prio": 0,
  "Detach": false,
  "User": "root",
  "Tags": {
    "@admin": true
  }
}
  • Method: Is the latest node of the path
  • Path: Is the remaining of the path that is left after removing the method
  • Params: Object with the parameters informed in this request
  • Prio: In case that more than one task is pending to be handled, the one with higher priority will be served first. If all tasks in the queue have the same priority, order is not ensured.
  • Detach:
  • User: User requesting the task
  • Tags: Metadata related to the user

Clone this wiki locally

⌂ 换网址