Sha256: b7438f300f08fa96aeb4ed07991812daa0b453048ef7a32417189c02522cd9f0

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# Tasks

Tasks are the units of work processed by jobs. A task consists of:

1. The URL to process
2. The batch the task belongs to

Like URLs, batches are strings. Within a batch, every URL gets processed at most
once.

Tasks get appended to the end of a message queue, and consumed gfrom their
beginning by jobs.

When jobs process tasks, they search their routing tree for a matching route.
URLs that match no route are not retrieved, and their task considered
successfully processed without further action.

## Task Metadata

At runtime, tasks take the shape of a `Wayfarer::Task` object. While only URL
and batch are persisted to message queues, tasks carry an arbitrarily assignable
`metadata` object:

```ruby
task          # => #<Task url="https://example.com" batch="547b761-d0ad-...">
task.metadata # => #<OpenStruct>
task.metadata.my_piece_of_information = "hello"
```

`task.metadata` is ephemeral and only accessible at runtime.

Once a job consumes a task, the job instance becomes accessible on it:

```
task.job # => #<DummyJob ...>
```


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wayfarer-0.4.1 docs/guides/tasks.md
wayfarer-0.4.0 docs/guides/tasks.md