tlq-client 0.2.1 → 0.4.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/CHANGELOG.md +6 -0
- data/README.md +9 -1
- data/lib/tlq_client/version.rb +1 -1
- data/lib/tlq_client.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40f40f39e20c3a46bb0d6cc6a5517fbb2d581e4996893307bffc84582f90bb15
|
|
4
|
+
data.tar.gz: 0f1686b89b1306f27866738e029709ec1e58d736ae87363f67660a1e7edcad1a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0da8db4deaf928c53ebd6f2caf1973054efe290b556253bfe022a4c2f8eaa3e27eabd64e474a18f83922ffb56c3ec50bd6b9ffd9151c32064f7e62f0fc86f578
|
|
7
|
+
data.tar.gz: 3863fa188edd2a85f074a9da0cf7e219f3c5528f4b4c3a1fcb41fb0ae74aab0d62b564044d419591a0bebee9f2f34ad2ec5f2459a9955b26b517aaea189bb157
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.0] - 2026-03-21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `stats` - Get queue statistics (ready, processing, dead counts)
|
|
13
|
+
|
|
8
14
|
## [0.2.0] - 2025-11-26
|
|
9
15
|
|
|
10
16
|
### Added
|
data/README.md
CHANGED
|
@@ -58,6 +58,10 @@ ids = messages.map { |m| m['id'] }
|
|
|
58
58
|
client.delete_messages(ids) # Delete multiple
|
|
59
59
|
client.retry_messages(ids) # Retry multiple
|
|
60
60
|
|
|
61
|
+
# Queue statistics
|
|
62
|
+
stats = client.stats
|
|
63
|
+
puts stats # => {"ready" => 10, "processing" => 2, "dead" => 0}
|
|
64
|
+
|
|
61
65
|
# Health check
|
|
62
66
|
client.health_check # => true
|
|
63
67
|
|
|
@@ -100,13 +104,17 @@ Returns messages to the queue for reprocessing. Increments `retry_count`. Accept
|
|
|
100
104
|
|
|
101
105
|
Removes all messages from the queue. Cannot be undone.
|
|
102
106
|
|
|
107
|
+
### `stats → Hash`
|
|
108
|
+
|
|
109
|
+
Returns queue statistics with `ready`, `processing`, and `dead` counts.
|
|
110
|
+
|
|
103
111
|
### `health_check → Boolean`
|
|
104
112
|
|
|
105
113
|
Returns `true` if the TLQ server is reachable.
|
|
106
114
|
|
|
107
115
|
## Requirements
|
|
108
116
|
|
|
109
|
-
- Ruby >=
|
|
117
|
+
- Ruby >= 3.1
|
|
110
118
|
- Running [TLQ server](https://github.com/skyaktech/tlq)
|
|
111
119
|
|
|
112
120
|
## Development
|
data/lib/tlq_client/version.rb
CHANGED
data/lib/tlq_client.rb
CHANGED
|
@@ -168,6 +168,26 @@ class TLQClient
|
|
|
168
168
|
raise "HTTP request failed: #{e.message}"
|
|
169
169
|
end
|
|
170
170
|
|
|
171
|
+
# Returns queue statistics from the TLQ server.
|
|
172
|
+
#
|
|
173
|
+
# @return [Hash] queue statistics containing 'ready', 'processing', and 'dead' counts
|
|
174
|
+
#
|
|
175
|
+
# @raise [RuntimeError] if the server response cannot be parsed as JSON
|
|
176
|
+
# @raise [RuntimeError] if the HTTP request fails
|
|
177
|
+
#
|
|
178
|
+
# @example Get queue stats
|
|
179
|
+
# stats = client.stats
|
|
180
|
+
# puts "Ready: #{stats['ready']}, Processing: #{stats['processing']}, Dead: #{stats['dead']}"
|
|
181
|
+
def stats
|
|
182
|
+
uri = URI("#{@base_uri}/stats")
|
|
183
|
+
response = Net::HTTP.get_response(uri)
|
|
184
|
+
JSON.parse(response.body)
|
|
185
|
+
rescue JSON::ParserError => e
|
|
186
|
+
raise "Failed to parse response: #{e.message}"
|
|
187
|
+
rescue StandardError => e
|
|
188
|
+
raise "HTTP request failed: #{e.message}"
|
|
189
|
+
end
|
|
190
|
+
|
|
171
191
|
# Checks if the TLQ server is reachable and responding.
|
|
172
192
|
#
|
|
173
193
|
# @return [Boolean] true if the server is healthy and responding
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tlq-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nebojsa Jakovljevic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|