Sha256: 62e0dcd5cde412eb4142fb9001cc663b045117ead8f70c663eb7484ad13667b8

Contents?: true

Size: 499 Bytes

Versions: 4

Compression:

Stored size: 499 Bytes

Contents

# Batch routing

```ruby
# Create a record in an external database and store the hostname
record = Database::Row.create(hostname: "example.com")

class DummyJob < Wayfarer::Base
  route do |hostname|
    host hostname, to: :index
  end

  steer do |task|
    # Pass the external record's hostname to the router
    [Database::Row.find(task.batch).hostname]
  end

  # ...
end

# Enqueue the task and use the database record's key as batch
DummyJob.crawl("https://example.com", batch: record.id)
```

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wayfarer-0.4.7 docs/cookbook/batch_routing.md
wayfarer-0.4.6 docs/cookbook/batch_routing.md
wayfarer-0.4.5 docs/cookbook/batch_routing.md
wayfarer-0.4.4 docs/cookbook/batch_routing.md