async-job-adapter-active_job 0.18.2 → 0.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78139525c5bd60e912b5c01d8061cdb88340ca1524e67bb69c5ab97e6c9b8d96
4
- data.tar.gz: 835dc24d9d85c2ac5e63746ea508fa9bf3e739b3f4dbc7baeab6c57d86c4e5b7
3
+ metadata.gz: d1bbfff85274ea269f116a3f132597b47f3ea3b5c779e8f893be417667e97b51
4
+ data.tar.gz: df0c48976f7491946920cfc22d5f55c54ed721c3d2a64648132549f61704d53a
5
5
  SHA512:
6
- metadata.gz: b3692d7a9129eaa924ebc56e184eaa7f40b865538eb0f264d59cebe96a120b143fb64710ac5c9b8a2e4485f2a0c55ac1195067e6e0fd18c33287c642c15d4c0b
7
- data.tar.gz: a0370cb74d1250d67266508981dda880d02e2800309fb7a01b46e438c390e674992114082cd8498c25a5c0499371a70b500fc9304768807efb0fdae86826de61
6
+ metadata.gz: cfdbc700bb7a0590654d2738179d88da75fd3af5c8144283dd17a227ab57f81943f37b19b316a095165bb0f0590d299a331b114c11324abef2b1439d1e2bd9b5
7
+ data.tar.gz: eefa235bc071368f8d699556b682772e54d8d28dcb17ac2533c214be530b7504211208212320d3fc2d902dc50bd5f04b6b8c71d628f2f05743acd5b0ccde8e5a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,98 @@
1
+ # Getting Started
2
+
3
+ This guide explains how to get started with the `async-job-adapter-active_job` gem.
4
+
5
+ ## Installation
6
+
7
+ Add the gem to your Rails project:
8
+
9
+ ``` bash
10
+ $ bundle add async-job-adapter-active_job
11
+ ```
12
+
13
+ ## Core Concepts
14
+
15
+ The `async-job-adapter-active_job` gem provides an Active Job adapter for the `async-job` gem. This allows you to use the `async-job` gem with Rails' built-in Active Job framework.
16
+
17
+ - The {ruby Async::Job::ActiveJob::Dispatcher} class manages zero or more queues.
18
+ - The {ruby Async::Job::ActiveJob::Railtie} class provides a convenient interface for configuring the integration.
19
+
20
+ In general, `Async::Job` has a concept of queues, where jobs enter into a queue, may get serialized to a queue, then deserialized and processed. This ActiveJob adapter provides {ruby Async::Job::ActiveJob::Interface} which goes at the head of the queue, and matches the interface that ActiveJob expects for enqueueing jobs. At the tail of the queue, the {ruby Async::Job::ActiveJob::Executor} class is responsible for processing jobs by dispatching back into ActiveJob.
21
+
22
+ ## Usage
23
+
24
+ In order to use `Async::Job`, you need to define your queues and configure the Active Job adapter. Here is an example configuration:
25
+
26
+ ### `ActiveJob` Queue Adapter Configuration
27
+
28
+ You can configure the ActiveJob queue adapter globally (in `config/application.rb`) or per-environment (in `config/environments/*.rb`).
29
+
30
+ ```
31
+ # In config/application.rb or config/environments/*.rb
32
+
33
+ config.active_job.queue_adapter = :async_job
34
+ ```
35
+
36
+ ### `Async::Job` Queue Configuration
37
+
38
+ You can define your queues in an initializer file (e.g., `config/initializers/async_job.rb`). Here is an example configuration that sets up two queues: a default queue using Redis and a local queue that processes jobs inline.
39
+
40
+ ``` ruby
41
+ # config/initializers/async_job.rb
42
+
43
+ require "async/job/processor/redis"
44
+ require "async/job/processor/inline"
45
+
46
+ Rails.application.configure do
47
+ # Create a queue for the "default" backend:
48
+ config.async_job.define_queue "default" do
49
+ dequeue Async::Job::Processor::Redis
50
+ end
51
+
52
+ # Create a queue named "local" which uses the Inline backend:
53
+ config.async_job.define_queue "local" do
54
+ dequeue Async::Job::Processor::Inline
55
+ end
56
+ end
57
+ ```
58
+
59
+ #### Job Specific Configuration
60
+
61
+ Rather than using `Async::Job` for all jobs, you could opt in using a specific queue adapter for a specific job. Here is an example:
62
+
63
+ ``` ruby
64
+ class MyJob < ApplicationJob
65
+ self.queue_adapter = :async_job
66
+ queue_as :local
67
+
68
+ # ...
69
+ end
70
+ ```
71
+
72
+ ### Running A Server
73
+
74
+ If you are using a queue that requires a server (e.g. Redis), you will need to run a server. A simple server is provided `async-job-adapter-active_job-server`, which by default will run all define queues.
75
+
76
+ ``` bash
77
+ $ bundle exec async-job-adapter-active_job-server
78
+ ```
79
+
80
+ You can specify different queues using the `ASYNC_JOB_ADAPTER_ACTIVE_JOB_QUEUE_NAMES` environment variable.
81
+
82
+ Alternatively, you may prefer to run your own service. See the code in `bin/async-job-adapter-active_job-server` for an example of how to run a server using a service definition.
83
+
84
+ ### Enqueuing Jobs
85
+
86
+ To enqueue a job, you can use the `perform_later` method in your Active Job class. Here is an example:
87
+
88
+ ``` ruby
89
+ class MyJob < ApplicationJob
90
+ queue_as :default
91
+
92
+ def perform(message)
93
+ puts message
94
+ end
95
+ end
96
+
97
+ MyJob.perform_later("Hello, world!")
98
+ ```
@@ -0,0 +1,12 @@
1
+ # Automatically generated context index for Utopia::Project guides.
2
+ # Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`.
3
+ ---
4
+ description: A asynchronous job queue for Ruby on Rails.
5
+ metadata:
6
+ documentation_uri: https://socketry.github.io/async-job-adapter-active_job/
7
+ source_code_uri: https://github.com/socketry/async-job-adapter-active_job.git
8
+ files:
9
+ - path: getting-started.md
10
+ title: Getting Started
11
+ description: This guide explains how to get started with the `async-job-adapter-active_job`
12
+ gem.
@@ -7,7 +7,7 @@ module Async
7
7
  module Job
8
8
  module Adapter
9
9
  module ActiveJob
10
- VERSION = "0.18.2"
10
+ VERSION = "0.18.3"
11
11
  end
12
12
  end
13
13
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-job-adapter-active_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 0.18.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -74,6 +74,8 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - bin/async-job-adapter-active_job-server
77
+ - context/getting-started.md
78
+ - context/index.yaml
77
79
  - lib/active_job/queue_adapters/async_job_adapter.rb
78
80
  - lib/async/job/adapter/active_job.rb
79
81
  - lib/async/job/adapter/active_job/dispatcher.rb
metadata.gz.sig CHANGED
Binary file