Sha256: 1d31735c59a526d5b1865326a71563b819791bc3c577201879a08a87eb686874

Contents?: true

Size: 505 Bytes

Versions: 2

Compression:

Stored size: 505 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_later("https://example.com", batch: record.id)
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wayfarer-0.4.3 docs/cookbook/batch_routing.md
wayfarer-0.4.2 docs/cookbook/batch_routing.md