Skip to content

Commit d7bba65

Browse files
committed
Bump patch version.
1 parent 2ea00fa commit d7bba65

File tree

7 files changed

+137
-9
lines changed

7 files changed

+137
-9
lines changed

context/aggregate-queue.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Aggregate Queue
2+
3+
This guide explains how to use the Aggregate queue to reduce input latency and improve the performance of your application.
4+
5+
## Overview
6+
7+
The {ruby Async::Job::Queue::Aggregate} queue is designed to reduce front-end processing latency by accumulating multiple jobs which are then processed together. This is particularly useful when you are scheduling jobs during a request-response cycle, as it allows you to move processing latency to a background task. However, as a consequence, it may reduce the overall robustness of your application, as a failure during processing may result in jobs being lost. The aggregate queue tries to mitigate this risk by ensuring all pending jobs are processed before the application exits, but it is not guaranteed.
8+
9+
## Usage
10+
11+
You can add the aggregate queue to an existing queue:
12+
13+
~~~ ruby
14+
pipeline = Async::Job::Builder.build(buffer) do
15+
# Aggregating before passing the job into Redis will avoid Redis latency issues affecting the front-end:
16+
enqueue Async::Job::Queue::Aggregate
17+
dequeue Async::Job::Queue::Redis
18+
end
19+
~~~

context/getting-started.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Getting Started
2+
3+
This guide gives you an overview of the `async-job` gem and explains the core concepts.
4+
5+
## Installation
6+
7+
Add the gem to your project:
8+
9+
``` shell
10+
$ bundle add async-job
11+
```
12+
13+
## Core Concepts
14+
15+
`async-job` is a library for building asynchronous job queues.
16+
17+
- Several included {ruby Async::Job::Queue} implementations for enqueueing and running jobs.
18+
- Several supported {ruby Async::Job::Coder} implementations for encoding and decoding job payloads.
19+
- A {ruby Async::Job::Generic} class which describes the minimum required job interface.
20+
21+
The `async-job` library provides a framework for enqueueing and dequeuing jobs, without prescribing how jobs are executed. It is expected that you would use this library to wrap existing schemas for job definition and execution. This design allows you to use `async-job` in a wide variety of applications, without the need for cumbersome wrappers.
22+
23+
## Usage
24+
25+
In general, a job processing system pipeline comprises two parts: a client that submits jobs into a queue, and a server that reads jobs out of a queue and processes them.
26+
27+
```mermaid
28+
sequenceDiagram
29+
participant A as Client (Application)
30+
participant ME as Middleware (Enqueue)
31+
participant S as Server (Queue)
32+
participant MD as Middleware (Dequeue)
33+
participant H as Delegate
34+
35+
Note over A,S: Client
36+
A->>+ME: Submit Job
37+
ME->>+S: Enqueue Job
38+
39+
Note over S,H: Server
40+
S->>+MD: Dequeue Job
41+
MD->>+H: Execute Job
42+
```
43+
44+
You can use {ruby Async::Job::Builder} to create a pipeline that includes both the producer and consumer sides of a queue:
45+
46+
```ruby
47+
require 'async'
48+
require 'async/job'
49+
require 'async/job/processor/inline'
50+
51+
# This is how we execute a job from the queue:
52+
executor = proc do |job|
53+
puts "Processing job: #{job}"
54+
end
55+
56+
# Create a simple inline pipeline:
57+
pipeline = Async::Job::Builder.build(executor) do
58+
# We are going to use an inline processor which processes the job in the background using Async{}:
59+
enqueue Async::Job::Processor::Inline
60+
end
61+
62+
# Enqueue a job:
63+
Async do
64+
pipeline.call("My job")
65+
# Prints "Processing job: My job"
66+
end
67+
```
68+
69+
## Rails Integration
70+
71+
You can use `async-job` with Rails's ActiveJob framework by using the `async-job-adapter-active_job` gem. This allows you to use `async-job` as a backend for ActiveJob, which is useful for integrating with existing Rails applications.
72+
73+
### Redis Processor
74+
75+
The `async-job-processor-redis` gem provides a Redis-based processor for `async-job`. This processor is similar to Sidekiq, and is designed to provide a similar interface and feature set.

context/index.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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: An asynchronous job queue for Ruby.
5+
metadata:
6+
documentation_uri: https://socketry.github.io/async-job/
7+
source_code_uri: https://github.com/socketry/async-job
8+
files:
9+
- path: getting-started.md
10+
title: Getting Started
11+
description: This guide gives you an overview of the `async-job` gem and explains
12+
the core concepts.
13+
- path: inline-queue.md
14+
title: Inline Queue
15+
description: This guide explains how to use the Inline queue to execute background
16+
jobs.
17+
- path: aggregate-queue.md
18+
title: Aggregate Queue
19+
description: This guide explains how to use the Aggregate queue to reduce input
20+
latency and improve the performance of your application.

context/inline-queue.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Inline Queue
2+
3+
This guide explains how to use the Inline queue to execute background jobs.
4+
5+
## Overview
6+
7+
The {ruby Async::Job::Queue::Inline} queue is designed to process jobs in the background using the `Async` framework. This is particularly useful when you want to execute jobs in the same process as the client, but in a separate task. The inline queue is ideal for low-latency jobs that do not require transactional consistency.
8+
9+
## Usage
10+
11+
You can use the inline queue for dequeueing and executing jobs:
12+
13+
~~~ ruby
14+
pipeline = Async::Job::Builder.build(buffer) do
15+
dequeue Async::Job::Queue::Inline
16+
end
17+
~~~

lib/async/job/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
module Async
77
module Job
8-
VERSION = "0.10.1"
8+
VERSION = "0.10.2"
99
end
1010
end

readme.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ Please see the [project documentation](https://socketry.github.io/async-job/) fo
1818

1919
Please see the [project releases](https://socketry.github.io/async-job/releases/index) for all releases.
2020

21+
### v0.10.2
22+
23+
- Minor code cleanup.
24+
2125
### v0.10.1
2226

2327
- Add release notes and modernize code.
2428
- Add external tests.
2529
- Improve test formatting and modernize code.
2630
- Achieve 100% test coverage.
2731
- Achieve 100% documentation coverage.
28-
- Add agent context.
2932

3033
### v0.10.0
3134

@@ -72,12 +75,6 @@ Please see the [project releases](https://socketry.github.io/async-job/releases/
7275
- Add client and server example (\#3).
7376
- Fix gem name in guide.
7477

75-
### v0.5.0
76-
77-
- Add benchmark example.
78-
- Add support for `Async::Idler`.
79-
- Add link to `async-job-adapter-active_job`.
80-
8178
## See Also
8279

8380
- [async-job-processor-redis](https://github.com/socketry/async-job-processor-redis) - Redis processor for `async-job` (similar to Sidekiq).

releases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Releases
22

3-
## Unreleased
3+
## v0.10.2
44

55
- Minor code cleanup.
66

0 commit comments

Comments
 (0)