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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0888c52bfd5c94d767673f92efe410094daa86fa50d844408e4830cee364130a'
4
- data.tar.gz: 796ed9252ce96e44464f39b99296d09ce7a3763cb2d0eb62594e40fad98c3a41
3
+ metadata.gz: 40f40f39e20c3a46bb0d6cc6a5517fbb2d581e4996893307bffc84582f90bb15
4
+ data.tar.gz: 0f1686b89b1306f27866738e029709ec1e58d736ae87363f67660a1e7edcad1a
5
5
  SHA512:
6
- metadata.gz: c986e9700b352ebb948511e61fdb48a5cf92387456c5e1e40bad75f9a7d03bd2b852f985439c9662c91e92ffa28a530d2aef2d60ab3882555a9b76ae09563148
7
- data.tar.gz: c9aabb8ad51cf2e4e70b072c6fe42291506bef4ef556a240be2529df03f8599cb1cf2ea0826d6586f912fa7b9cc8273fe7c48cce442743c5031fa0ba666c300b
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 >= 2.6
117
+ - Ruby >= 3.1
110
118
  - Running [TLQ server](https://github.com/skyaktech/tlq)
111
119
 
112
120
  ## Development
@@ -3,5 +3,5 @@
3
3
  class TLQClient
4
4
  # The current version of the TLQClient gem.
5
5
  # @return [String] the semantic version string
6
- VERSION = "0.2.1"
6
+ VERSION = "0.4.0"
7
7
  end
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.2.1
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: 2025-11-28 00:00:00.000000000 Z
11
+ date: 2026-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler