pgmq-ruby 0.1.0 → 0.3.0
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 +4 -4
- data/.coditsu/ci.yml +3 -0
- data/.github/workflows/ci.yml +161 -0
- data/.github/workflows/push.yml +35 -0
- data/.gitignore +67 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.yard-lint.yml +168 -0
- data/CHANGELOG.md +103 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +65 -0
- data/LICENSE +165 -0
- data/README.md +627 -0
- data/Rakefile +4 -0
- data/docker-compose.yml +22 -0
- data/lib/pgmq/client/consumer.rb +155 -0
- data/lib/pgmq/client/maintenance.rb +46 -0
- data/lib/pgmq/client/message_lifecycle.rb +240 -0
- data/lib/pgmq/client/metrics.rb +49 -0
- data/lib/pgmq/client/multi_queue.rb +193 -0
- data/lib/pgmq/client/producer.rb +80 -0
- data/lib/pgmq/client/queue_management.rb +112 -0
- data/lib/pgmq/client.rb +138 -0
- data/lib/pgmq/connection.rb +196 -0
- data/lib/pgmq/errors.rb +30 -0
- data/lib/pgmq/message.rb +45 -0
- data/lib/pgmq/metrics.rb +37 -0
- data/lib/pgmq/queue_metadata.rb +37 -0
- data/lib/pgmq/transaction.rb +105 -0
- data/lib/pgmq/version.rb +6 -0
- data/lib/pgmq.rb +53 -0
- data/pgmq-ruby.gemspec +32 -0
- data/renovate.json +18 -0
- metadata +66 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53bd6f9c6cbc408bf96813d0fa19f16d753a52a52edc93f87db61444cb2cfbd8
|
|
4
|
+
data.tar.gz: ca1b41b82cf2cf4cde197e03309c516be9430b91f5c7ad06d0bdeea7f83b3812
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 127cb4848ce4aae0929690794dbbe128bc8ed8449b28e41687f6268152005810378b7e63cabc9cde7bcbd66701a7b4a689cf864dee48e6196a6715df2e02ead4
|
|
7
|
+
data.tar.gz: 007c60255e9c87ba2e68765a4248319ac378677646739ac44b5f59db803a5effa27c36118e6f641d9f4145497309df11f1688080d72ca021f74c6139c88738f5
|
data/.coditsu/ci.yml
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
concurrency:
|
|
4
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
5
|
+
cancel-in-progress: true
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [ master ]
|
|
10
|
+
schedule:
|
|
11
|
+
- cron: '0 1 * * *'
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
specs:
|
|
18
|
+
timeout-minutes: 15
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
ruby:
|
|
24
|
+
- '3.5.0-preview1'
|
|
25
|
+
- '3.4'
|
|
26
|
+
- '3.3'
|
|
27
|
+
- '3.2'
|
|
28
|
+
postgres:
|
|
29
|
+
- '14'
|
|
30
|
+
- '15'
|
|
31
|
+
- '16'
|
|
32
|
+
- '17'
|
|
33
|
+
- '18'
|
|
34
|
+
include:
|
|
35
|
+
- ruby: '3.4'
|
|
36
|
+
postgres: '18'
|
|
37
|
+
coverage: 'true'
|
|
38
|
+
|
|
39
|
+
services:
|
|
40
|
+
postgres:
|
|
41
|
+
image: ghcr.io/pgmq/pg${{ matrix.postgres }}-pgmq:latest
|
|
42
|
+
env:
|
|
43
|
+
POSTGRES_USER: postgres
|
|
44
|
+
POSTGRES_PASSWORD: postgres
|
|
45
|
+
POSTGRES_DB: pgmq_test
|
|
46
|
+
options: >-
|
|
47
|
+
--health-cmd pg_isready
|
|
48
|
+
--health-interval 10s
|
|
49
|
+
--health-timeout 5s
|
|
50
|
+
--health-retries 5
|
|
51
|
+
ports:
|
|
52
|
+
- 5433:5432
|
|
53
|
+
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
56
|
+
with:
|
|
57
|
+
fetch-depth: 0
|
|
58
|
+
|
|
59
|
+
- name: Install package dependencies
|
|
60
|
+
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends postgresql-client"
|
|
61
|
+
|
|
62
|
+
- name: Remove Gemfile.lock for Ruby previews
|
|
63
|
+
if: contains(matrix.ruby, '3.5')
|
|
64
|
+
run: rm -f Gemfile.lock
|
|
65
|
+
|
|
66
|
+
- name: Set up Ruby
|
|
67
|
+
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
|
|
68
|
+
with:
|
|
69
|
+
ruby-version: ${{ matrix.ruby }}
|
|
70
|
+
bundler-cache: true
|
|
71
|
+
bundler: 'latest'
|
|
72
|
+
self-hosted: false
|
|
73
|
+
|
|
74
|
+
- name: Wait for PostgreSQL
|
|
75
|
+
run: sleep 5
|
|
76
|
+
|
|
77
|
+
- name: Install latest bundler
|
|
78
|
+
run: |
|
|
79
|
+
gem install bundler --no-document
|
|
80
|
+
gem update --system --no-document
|
|
81
|
+
bundle config set without 'tools benchmarks docs'
|
|
82
|
+
|
|
83
|
+
- name: Bundle install
|
|
84
|
+
run: |
|
|
85
|
+
bundle config set without development
|
|
86
|
+
bundle install --jobs 4 --retry 3
|
|
87
|
+
|
|
88
|
+
- name: Create PGMQ extension
|
|
89
|
+
env:
|
|
90
|
+
PGPASSWORD: postgres
|
|
91
|
+
run: |
|
|
92
|
+
psql -h localhost -p 5433 -U postgres -d pgmq_test -c "CREATE EXTENSION IF NOT EXISTS pgmq CASCADE;"
|
|
93
|
+
|
|
94
|
+
- name: Run all tests
|
|
95
|
+
env:
|
|
96
|
+
PG_HOST: localhost
|
|
97
|
+
PG_PORT: 5433
|
|
98
|
+
PG_DATABASE: pgmq_test
|
|
99
|
+
PG_USER: postgres
|
|
100
|
+
PG_PASSWORD: postgres
|
|
101
|
+
CI: true
|
|
102
|
+
GITHUB_COVERAGE: ${{ matrix.coverage }}
|
|
103
|
+
run: bundle exec rspec
|
|
104
|
+
|
|
105
|
+
yard-lint:
|
|
106
|
+
timeout-minutes: 5
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
strategy:
|
|
109
|
+
fail-fast: false
|
|
110
|
+
steps:
|
|
111
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
112
|
+
with:
|
|
113
|
+
fetch-depth: 0
|
|
114
|
+
- name: Set up Ruby
|
|
115
|
+
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
|
|
116
|
+
with:
|
|
117
|
+
ruby-version: '3.4.7'
|
|
118
|
+
bundler-cache: true
|
|
119
|
+
- name: Run yard-lint
|
|
120
|
+
run: bundle exec yard-lint lib/
|
|
121
|
+
|
|
122
|
+
coditsu:
|
|
123
|
+
timeout-minutes: 5
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
strategy:
|
|
126
|
+
fail-fast: false
|
|
127
|
+
steps:
|
|
128
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
129
|
+
with:
|
|
130
|
+
fetch-depth: 0
|
|
131
|
+
- name: Download Coditsu script
|
|
132
|
+
run: |
|
|
133
|
+
curl -sSL https://api.coditsu.io/run/ci -o coditsu_script.sh
|
|
134
|
+
chmod +x coditsu_script.sh
|
|
135
|
+
- name: Verify Coditsu script checksum
|
|
136
|
+
run: |
|
|
137
|
+
EXPECTED_SHA256="0aecc5aa010f53fca264548a41467a2b0a1208d750ce1da3e98a217304cacbbc"
|
|
138
|
+
ACTUAL_SHA256=$(sha256sum coditsu_script.sh | awk '{ print $1 }')
|
|
139
|
+
if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then
|
|
140
|
+
echo "::error::Checksum verification failed. Expected $EXPECTED_SHA256 but got $ACTUAL_SHA256."
|
|
141
|
+
exit 1
|
|
142
|
+
fi
|
|
143
|
+
- name: Run Coditsu
|
|
144
|
+
run: ./coditsu_script.sh
|
|
145
|
+
|
|
146
|
+
ci-success:
|
|
147
|
+
name: CI Success
|
|
148
|
+
runs-on: ubuntu-latest
|
|
149
|
+
if: always()
|
|
150
|
+
needs:
|
|
151
|
+
- coditsu
|
|
152
|
+
- specs
|
|
153
|
+
- yard-lint
|
|
154
|
+
steps:
|
|
155
|
+
- name: Check all jobs passed
|
|
156
|
+
if: |
|
|
157
|
+
contains(needs.*.result, 'failure') ||
|
|
158
|
+
contains(needs.*.result, 'cancelled') ||
|
|
159
|
+
contains(needs.*.result, 'skipped')
|
|
160
|
+
run: exit 1
|
|
161
|
+
- run: echo "All CI checks passed!"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Push Gem
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- v*
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
push:
|
|
13
|
+
if: github.repository_owner == 'mensfeld'
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: deployment
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
- name: Set up Ruby
|
|
27
|
+
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
|
|
28
|
+
with:
|
|
29
|
+
bundler-cache: false
|
|
30
|
+
|
|
31
|
+
- name: Bundle install
|
|
32
|
+
run: |
|
|
33
|
+
bundle install --jobs 4 --retry 3
|
|
34
|
+
|
|
35
|
+
- uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
|
data/.gitignore
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/spec/examples.txt
|
|
9
|
+
/test/tmp/
|
|
10
|
+
/test/version_tmp/
|
|
11
|
+
/tmp/
|
|
12
|
+
|
|
13
|
+
# Used by dotenv library to load environment variables.
|
|
14
|
+
# .env
|
|
15
|
+
|
|
16
|
+
# Ignore Byebug command history file.
|
|
17
|
+
.byebug_history
|
|
18
|
+
|
|
19
|
+
## Specific to RubyMotion:
|
|
20
|
+
.dat*
|
|
21
|
+
.repl_history
|
|
22
|
+
build/
|
|
23
|
+
*.bridgesupport
|
|
24
|
+
build-iPhoneOS/
|
|
25
|
+
build-iPhoneSimulator/
|
|
26
|
+
|
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
|
28
|
+
#
|
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
32
|
+
#
|
|
33
|
+
# vendor/Pods/
|
|
34
|
+
|
|
35
|
+
## Documentation cache and generated files:
|
|
36
|
+
/.yardoc/
|
|
37
|
+
/_yardoc/
|
|
38
|
+
/doc/
|
|
39
|
+
/rdoc/
|
|
40
|
+
|
|
41
|
+
## RSpec test status file
|
|
42
|
+
.rspec_status
|
|
43
|
+
|
|
44
|
+
## Environment normalization:
|
|
45
|
+
/.bundle/
|
|
46
|
+
/vendor/bundle
|
|
47
|
+
/lib/bundler/man/
|
|
48
|
+
|
|
49
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
50
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
51
|
+
# Gemfile.lock
|
|
52
|
+
# .ruby-version
|
|
53
|
+
# .ruby-gemset
|
|
54
|
+
|
|
55
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
56
|
+
.rvmrc
|
|
57
|
+
|
|
58
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
|
59
|
+
# .rubocop-https?--*
|
|
60
|
+
|
|
61
|
+
.DS_Store
|
|
62
|
+
|
|
63
|
+
## Claude Code settings (user-specific)
|
|
64
|
+
.claude/
|
|
65
|
+
|
|
66
|
+
## Coditsu configuration (user-specific)
|
|
67
|
+
.coditsu/local.yml
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.5
|
data/.yard-lint.yml
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# YARD-Lint Configuration
|
|
2
|
+
# See https://github.com/mensfeld/yard-lint for documentation
|
|
3
|
+
|
|
4
|
+
# Global settings for all validators
|
|
5
|
+
AllValidators:
|
|
6
|
+
# YARD command-line options (applied to all validators by default)
|
|
7
|
+
YardOptions:
|
|
8
|
+
- --private
|
|
9
|
+
- --protected
|
|
10
|
+
|
|
11
|
+
# Global file exclusion patterns
|
|
12
|
+
Exclude:
|
|
13
|
+
- '\.git'
|
|
14
|
+
- 'vendor/**/*'
|
|
15
|
+
- 'node_modules/**/*'
|
|
16
|
+
- 'spec/**/*'
|
|
17
|
+
- 'test/**/*'
|
|
18
|
+
|
|
19
|
+
# Exit code behavior (error, warning, convention, never)
|
|
20
|
+
FailOnSeverity: error
|
|
21
|
+
|
|
22
|
+
# Require 100% documentation coverage
|
|
23
|
+
RequiredCoverage: 100
|
|
24
|
+
|
|
25
|
+
# Documentation validators
|
|
26
|
+
Documentation/UndocumentedObjects:
|
|
27
|
+
Description: 'Checks for classes, modules, and methods without documentation.'
|
|
28
|
+
Enabled: true
|
|
29
|
+
Severity: error
|
|
30
|
+
ExcludedMethods:
|
|
31
|
+
- 'initialize/0' # Exclude parameter-less initialize
|
|
32
|
+
- '/^_/' # Exclude private methods (by convention)
|
|
33
|
+
|
|
34
|
+
Documentation/UndocumentedMethodArguments:
|
|
35
|
+
Description: 'Checks for method parameters without @param tags.'
|
|
36
|
+
Enabled: true
|
|
37
|
+
Severity: error
|
|
38
|
+
|
|
39
|
+
Documentation/UndocumentedBooleanMethods:
|
|
40
|
+
Description: 'Checks that question mark methods document their boolean return.'
|
|
41
|
+
Enabled: true
|
|
42
|
+
Severity: error
|
|
43
|
+
|
|
44
|
+
Documentation/UndocumentedOptions:
|
|
45
|
+
Description: 'Detects methods with options hash parameters but no @option tags.'
|
|
46
|
+
Enabled: true
|
|
47
|
+
Severity: error
|
|
48
|
+
|
|
49
|
+
Documentation/MarkdownSyntax:
|
|
50
|
+
Description: 'Detects common markdown syntax errors in documentation.'
|
|
51
|
+
Enabled: true
|
|
52
|
+
Severity: error
|
|
53
|
+
|
|
54
|
+
# Tags validators
|
|
55
|
+
Tags/Order:
|
|
56
|
+
Description: 'Enforces consistent ordering of YARD tags.'
|
|
57
|
+
Enabled: true
|
|
58
|
+
Severity: error
|
|
59
|
+
EnforcedOrder:
|
|
60
|
+
- param
|
|
61
|
+
- option
|
|
62
|
+
- return
|
|
63
|
+
- raise
|
|
64
|
+
- example
|
|
65
|
+
|
|
66
|
+
Tags/InvalidTypes:
|
|
67
|
+
Description: 'Validates type definitions in @param, @return, @option tags.'
|
|
68
|
+
Enabled: true
|
|
69
|
+
Severity: error
|
|
70
|
+
ValidatedTags:
|
|
71
|
+
- param
|
|
72
|
+
- option
|
|
73
|
+
- return
|
|
74
|
+
|
|
75
|
+
Tags/TypeSyntax:
|
|
76
|
+
Description: 'Validates YARD type syntax using YARD parser.'
|
|
77
|
+
Enabled: true
|
|
78
|
+
Severity: error
|
|
79
|
+
ValidatedTags:
|
|
80
|
+
- param
|
|
81
|
+
- option
|
|
82
|
+
- return
|
|
83
|
+
- yieldreturn
|
|
84
|
+
|
|
85
|
+
Tags/MeaninglessTag:
|
|
86
|
+
Description: 'Detects @param/@option tags on classes, modules, or constants.'
|
|
87
|
+
Enabled: true
|
|
88
|
+
Severity: error
|
|
89
|
+
CheckedTags:
|
|
90
|
+
- param
|
|
91
|
+
- option
|
|
92
|
+
InvalidObjectTypes:
|
|
93
|
+
- class
|
|
94
|
+
- module
|
|
95
|
+
- constant
|
|
96
|
+
|
|
97
|
+
Tags/CollectionType:
|
|
98
|
+
Description: 'Validates Hash collection syntax consistency.'
|
|
99
|
+
Enabled: true
|
|
100
|
+
Severity: error
|
|
101
|
+
EnforcedStyle: long # 'long' for Hash{K => V} (YARD standard), 'short' for {K => V}
|
|
102
|
+
ValidatedTags:
|
|
103
|
+
- param
|
|
104
|
+
- option
|
|
105
|
+
- return
|
|
106
|
+
- yieldreturn
|
|
107
|
+
|
|
108
|
+
Tags/TagTypePosition:
|
|
109
|
+
Description: 'Validates type annotation position in tags.'
|
|
110
|
+
Enabled: true
|
|
111
|
+
Severity: error
|
|
112
|
+
CheckedTags:
|
|
113
|
+
- param
|
|
114
|
+
- option
|
|
115
|
+
# EnforcedStyle: 'type_after_name' (YARD standard: @param name [Type])
|
|
116
|
+
# or 'type_first' (@param [Type] name)
|
|
117
|
+
EnforcedStyle: type_after_name
|
|
118
|
+
|
|
119
|
+
Tags/ApiTags:
|
|
120
|
+
Description: 'Enforces @api tags on public objects.'
|
|
121
|
+
Enabled: true
|
|
122
|
+
Severity: error
|
|
123
|
+
AllowedApis:
|
|
124
|
+
- public
|
|
125
|
+
- private
|
|
126
|
+
- internal
|
|
127
|
+
|
|
128
|
+
Tags/OptionTags:
|
|
129
|
+
Description: 'Requires @option tags for methods with options parameters.'
|
|
130
|
+
Enabled: true
|
|
131
|
+
Severity: error
|
|
132
|
+
|
|
133
|
+
# Warnings validators - catches YARD parser errors
|
|
134
|
+
Warnings/UnknownTag:
|
|
135
|
+
Description: 'Detects unknown YARD tags.'
|
|
136
|
+
Enabled: true
|
|
137
|
+
Severity: error
|
|
138
|
+
|
|
139
|
+
Warnings/UnknownDirective:
|
|
140
|
+
Description: 'Detects unknown YARD directives.'
|
|
141
|
+
Enabled: true
|
|
142
|
+
Severity: error
|
|
143
|
+
|
|
144
|
+
Warnings/InvalidTagFormat:
|
|
145
|
+
Description: 'Detects malformed tag syntax.'
|
|
146
|
+
Enabled: true
|
|
147
|
+
Severity: error
|
|
148
|
+
|
|
149
|
+
Warnings/InvalidDirectiveFormat:
|
|
150
|
+
Description: 'Detects malformed directive syntax.'
|
|
151
|
+
Enabled: true
|
|
152
|
+
Severity: error
|
|
153
|
+
|
|
154
|
+
Warnings/DuplicatedParameterName:
|
|
155
|
+
Description: 'Detects duplicate @param tags.'
|
|
156
|
+
Enabled: true
|
|
157
|
+
Severity: error
|
|
158
|
+
|
|
159
|
+
Warnings/UnknownParameterName:
|
|
160
|
+
Description: 'Detects @param tags for non-existent parameters.'
|
|
161
|
+
Enabled: true
|
|
162
|
+
Severity: error
|
|
163
|
+
|
|
164
|
+
# Semantic validators
|
|
165
|
+
Semantic/AbstractMethods:
|
|
166
|
+
Description: 'Ensures @abstract methods do not have real implementations.'
|
|
167
|
+
Enabled: true
|
|
168
|
+
Severity: error
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0 (2025-11-14)
|
|
4
|
+
|
|
5
|
+
Initial release of pgmq-ruby - a low-level Ruby client for PGMQ (PostgreSQL Message Queue).
|
|
6
|
+
|
|
7
|
+
**Architecture Philosophy**: This library follows the rdkafka-ruby/Karafka pattern, providing a thin transport layer with direct 1:1 wrappers for PGMQ SQL functions. High-level features (instrumentation, job processing, Rails ActiveJob, retry strategies) belong in the planned `pgmq-framework` gem.
|
|
8
|
+
|
|
9
|
+
### Queue Management
|
|
10
|
+
- **[Feature]** Introduce `create(queue_name)` for standard queue creation.
|
|
11
|
+
- **[Feature]** Introduce `create_partitioned(queue_name, partition_interval:, retention_interval:)` for partitioned queues.
|
|
12
|
+
- **[Feature]** Introduce `create_unlogged(queue_name)` for high-throughput unlogged queues.
|
|
13
|
+
- **[Feature]** Introduce `drop_queue(queue_name)` for queue removal.
|
|
14
|
+
- **[Feature]** Introduce `list_queues` to retrieve all queue metadata.
|
|
15
|
+
- **[Feature]** Introduce `detach_archive(queue_name)` for archive table detachment.
|
|
16
|
+
- [Enhancement] Add queue name validation (48-char max, PostgreSQL identifier rules).
|
|
17
|
+
|
|
18
|
+
### Message Operations
|
|
19
|
+
- **[Feature]** Introduce `send(queue_name, message, delay:)` for single message publishing.
|
|
20
|
+
- **[Feature]** Introduce `send_batch(queue_name, messages)` for batch publishing.
|
|
21
|
+
- **[Feature]** Introduce `read(queue_name, vt:)` for single message consumption.
|
|
22
|
+
- **[Feature]** Introduce `read_batch(queue_name, vt:, qty:)` for batch consumption.
|
|
23
|
+
- **[Feature]** Introduce `read_with_poll(queue_name, vt:, max_poll_seconds:, poll_interval_ms:)` for long-polling.
|
|
24
|
+
- **[Feature]** Introduce `pop(queue_name)` for atomic read+delete operations.
|
|
25
|
+
- **[Feature]** Introduce `delete(queue_name, msg_id)` and `delete_batch(queue_name, msg_ids)` for message deletion.
|
|
26
|
+
- **[Feature]** Introduce `archive(queue_name, msg_id)` and `archive_batch(queue_name, msg_ids)` for message archival.
|
|
27
|
+
- **[Feature]** Introduce `purge_queue(queue_name)` for removing all messages.
|
|
28
|
+
- **[Feature]** Introduce `set_vt(queue_name, msg_id, vt:)` for visibility timeout updates.
|
|
29
|
+
|
|
30
|
+
### Multi-Queue Operations
|
|
31
|
+
- **[Feature]** Introduce `read_multi(queue_names, vt:, qty:, limit:)` for reading from multiple queues in single SQL query.
|
|
32
|
+
- **[Feature]** Introduce `read_multi_with_poll(queue_names, vt:, max_poll_seconds:, poll_interval_ms:)` for long-polling multiple queues.
|
|
33
|
+
- **[Feature]** Introduce `pop_multi(queue_names)` for atomic read+delete from first available queue.
|
|
34
|
+
- **[Feature]** Introduce `delete_multi(queue_to_msg_ids_hash)` for transactional bulk delete across queues.
|
|
35
|
+
- **[Feature]** Introduce `archive_multi(queue_to_msg_ids_hash)` for transactional bulk archive across queues.
|
|
36
|
+
- [Enhancement] All multi-queue operations use single database connection for efficiency.
|
|
37
|
+
- [Enhancement] Support for up to 50 queues per operation with automatic validation.
|
|
38
|
+
- [Enhancement] Queue name returned with each message for source tracking.
|
|
39
|
+
|
|
40
|
+
### Conditional JSONB Filtering
|
|
41
|
+
- **[Feature]** Introduce server-side message filtering using PostgreSQL's JSONB containment operator (`@>`).
|
|
42
|
+
- **[Feature]** Add `conditional:` parameter to `read()`, `read_batch()`, and `read_with_poll()` methods.
|
|
43
|
+
- [Enhancement] Support for filtering by single or multiple conditions with AND logic.
|
|
44
|
+
- [Enhancement] Support for nested JSON property filtering.
|
|
45
|
+
- [Enhancement] Filtering happens in PostgreSQL before returning results.
|
|
46
|
+
|
|
47
|
+
### Transaction Support
|
|
48
|
+
- **[Feature]** Introduce PostgreSQL transaction support via `client.transaction do |txn|` block.
|
|
49
|
+
- [Enhancement] Automatic rollback on errors for queue operations.
|
|
50
|
+
- [Enhancement] Enable atomic multi-queue coordination and exactly-once processing patterns.
|
|
51
|
+
|
|
52
|
+
### Monitoring & Metrics
|
|
53
|
+
- **[Feature]** Introduce `metrics(queue_name)` for queue statistics.
|
|
54
|
+
- **[Feature]** Introduce `metrics_all` for all queue statistics.
|
|
55
|
+
- **[Feature]** Introduce `stats()` for connection pool statistics.
|
|
56
|
+
|
|
57
|
+
### Connection Management
|
|
58
|
+
- **[Feature]** Introduce thread-safe connection pooling using `connection_pool` gem.
|
|
59
|
+
- **[Feature]** Support multiple connection strategies (string, hash, ENV variables, callables, direct injection).
|
|
60
|
+
- **[Feature]** Add configurable pool size (default: 5) and timeout (default: 5 seconds).
|
|
61
|
+
- **[Feature]** Add `auto_reconnect` option (default: true) for automatic connection recovery.
|
|
62
|
+
- [Enhancement] Connection health checks before use.
|
|
63
|
+
- [Enhancement] Full Fiber scheduler compatibility (Ruby 3.0+).
|
|
64
|
+
- [Enhancement] Proper handling of stale/closed connections with automatic reset.
|
|
65
|
+
- [Enhancement] Clear error messages for connection pool timeout.
|
|
66
|
+
|
|
67
|
+
### Rails Integration
|
|
68
|
+
- [Enhancement] Seamless ActiveRecord connection reuse via proc/lambda.
|
|
69
|
+
- [Enhancement] Zero additional database connections when using Rails connection pool.
|
|
70
|
+
|
|
71
|
+
### Serialization
|
|
72
|
+
- **[Feature]** Introduce pluggable serializer system.
|
|
73
|
+
- **[Feature]** Provide JSON serializer (default).
|
|
74
|
+
- **[Feature]** Support custom serializers via `PGMQ::Serializers::Base`.
|
|
75
|
+
|
|
76
|
+
### Error Handling
|
|
77
|
+
- **[Feature]** Introduce comprehensive error hierarchy with specific error classes for different failure modes.
|
|
78
|
+
|
|
79
|
+
### Value Objects
|
|
80
|
+
- **[Feature]** Introduce `PGMQ::Message` with msg_id, read_ct, enqueued_at, vt, payload.
|
|
81
|
+
- **[Feature]** Introduce `PGMQ::Metrics` for queue statistics.
|
|
82
|
+
- **[Feature]** Introduce `PGMQ::QueueMetadata` for queue information.
|
|
83
|
+
|
|
84
|
+
### Testing & Quality
|
|
85
|
+
- [Enhancement] 97.19% code coverage with 201 tests.
|
|
86
|
+
- [Enhancement] Comprehensive integration and unit test suites.
|
|
87
|
+
- [Enhancement] GitHub Actions CI/CD with matrix testing (Ruby 3.2-3.5, PostgreSQL 14-18).
|
|
88
|
+
- [Enhancement] Docker Compose setup for development.
|
|
89
|
+
|
|
90
|
+
### Security
|
|
91
|
+
- [Enhancement] Parameterized queries for all SQL operations preventing SQL injection.
|
|
92
|
+
|
|
93
|
+
### Documentation
|
|
94
|
+
- [Enhancement] Comprehensive README with quick start, API reference, and examples.
|
|
95
|
+
- [Enhancement] DEVELOPMENT.md for contributors.
|
|
96
|
+
- [Enhancement] Example scripts demonstrating all features.
|
|
97
|
+
|
|
98
|
+
### Dependencies
|
|
99
|
+
- Ruby >= 3.2.0
|
|
100
|
+
- PostgreSQL >= 14 with PGMQ extension
|
|
101
|
+
- `pg` gem (~> 1.5)
|
|
102
|
+
- `connection_pool` gem (~> 2.4)
|
|
103
|
+
- `zeitwerk` gem (~> 2.6)
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
pgmq-ruby (0.3.0)
|
|
5
|
+
connection_pool (~> 2.4)
|
|
6
|
+
pg (~> 1.5)
|
|
7
|
+
zeitwerk (~> 2.6)
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: https://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
connection_pool (2.5.4)
|
|
13
|
+
diff-lcs (1.6.2)
|
|
14
|
+
docile (1.4.1)
|
|
15
|
+
pg (1.6.2)
|
|
16
|
+
pg (1.6.2-aarch64-linux)
|
|
17
|
+
pg (1.6.2-aarch64-linux-musl)
|
|
18
|
+
pg (1.6.2-arm64-darwin)
|
|
19
|
+
pg (1.6.2-x86_64-darwin)
|
|
20
|
+
pg (1.6.2-x86_64-linux)
|
|
21
|
+
pg (1.6.2-x86_64-linux-musl)
|
|
22
|
+
rake (13.3.1)
|
|
23
|
+
rspec (3.13.2)
|
|
24
|
+
rspec-core (~> 3.13.0)
|
|
25
|
+
rspec-expectations (~> 3.13.0)
|
|
26
|
+
rspec-mocks (~> 3.13.0)
|
|
27
|
+
rspec-core (3.13.6)
|
|
28
|
+
rspec-support (~> 3.13.0)
|
|
29
|
+
rspec-expectations (3.13.5)
|
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
+
rspec-support (~> 3.13.0)
|
|
32
|
+
rspec-mocks (3.13.7)
|
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
34
|
+
rspec-support (~> 3.13.0)
|
|
35
|
+
rspec-support (3.13.6)
|
|
36
|
+
simplecov (0.22.0)
|
|
37
|
+
docile (~> 1.1)
|
|
38
|
+
simplecov-html (~> 0.11)
|
|
39
|
+
simplecov_json_formatter (~> 0.1)
|
|
40
|
+
simplecov-html (0.13.2)
|
|
41
|
+
simplecov_json_formatter (0.1.4)
|
|
42
|
+
yard (0.9.37)
|
|
43
|
+
yard-lint (1.2.3)
|
|
44
|
+
yard (~> 0.9)
|
|
45
|
+
zeitwerk (~> 2.6)
|
|
46
|
+
zeitwerk (2.7.3)
|
|
47
|
+
|
|
48
|
+
PLATFORMS
|
|
49
|
+
aarch64-linux
|
|
50
|
+
aarch64-linux-musl
|
|
51
|
+
arm64-darwin
|
|
52
|
+
ruby
|
|
53
|
+
x86_64-darwin
|
|
54
|
+
x86_64-linux
|
|
55
|
+
x86_64-linux-musl
|
|
56
|
+
|
|
57
|
+
DEPENDENCIES
|
|
58
|
+
pgmq-ruby!
|
|
59
|
+
rake
|
|
60
|
+
rspec
|
|
61
|
+
simplecov
|
|
62
|
+
yard-lint
|
|
63
|
+
|
|
64
|
+
BUNDLED WITH
|
|
65
|
+
2.7.2
|