lepus 0.2.1 → 0.2.2

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: 8cf7f4418578e3ab6600df2c9de267e134311af605a96db80f7b0f746763096d
4
- data.tar.gz: 469fda46acebe440afe6ecca36e78b7b4395c520bc789ed90183553c3eb78ed7
3
+ metadata.gz: a9eb1d12b4ce05f9c4e9070d7083b68417b7a41b7cdb2b1a99cad2931c9879fe
4
+ data.tar.gz: 1a6eafc5a47b48a228279e5ede1a06acfea053b04cf686e8984719633d60e66b
5
5
  SHA512:
6
- metadata.gz: ed0693421c238ba690ad399d072449920d73fdc63ec2437095ce8d8352bdf5aabfb65517ce34ed5aaae06fe68fa45aefa55dd31a3c1a743e5f80e43b3dbaad18
7
- data.tar.gz: 4fc5b7a1735979b94c94b7d6a6fd6979bf84c3479e19ec0661ba355c604af9233f218bf735dca9990a4d31197b468185506739c1f17b5618a2ffc664c39d3a43
6
+ metadata.gz: 40432e83f566507da124995e9a60130e10dbf54cc499ad8d3a6598369c0b8d3d9b78ab28be9fa6ca82812951092e28baead30d15d8b83feb6eeed9c6a30ebe32
7
+ data.tar.gz: '08948dbc7e9a927e2d26787a81c1106c1afb392aed5373248c54a02909a96d8d21b7e9f8c42a90e3ac4bc6179bfe1e5cc0c77c483be7d4808293bc6c51259213'
data/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.2.2 - 2026-10-30
8
+ * Added: `lepus start --except A,B` (and `Supervisor.new(except:)`) runs every consumer but the ones listed
9
+
7
10
  ## 0.2.1 - 2026-10-30
8
11
  * Added: `process_delivery.lepus` instrumentation around every consumed message, with consumer, exchange, routing key, redelivered flag and result
9
12
  * Added: `consumer_error.lepus` instrumentation when `#perform` raises, before the message is rejected
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lepus (0.2.1)
4
+ lepus (0.2.2)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
data/README.md CHANGED
@@ -567,6 +567,12 @@ bundle exec lepus start MyConsumer1 MyConsumer2 --debug
567
567
 
568
568
  Each consumer will run in a separate process, and a supervisor will monitor them. If a consumer crashes, the supervisor will restart it.
569
569
 
570
+ To run every consumer except some, for example to move one to its own deployment, use `--except` with a comma-separated list:
571
+
572
+ ```bash
573
+ bundle exec lepus start --except MyConsumer1,MyConsumer2
574
+ ```
575
+
570
576
  ### Instrumentation and logging
571
577
 
572
578
  Every consumed message emits a `process_delivery.lepus` event (`consumer`, `exchange`, `routing_key`, `redelivered`, `result`), and an exception raised by `#perform` emits `consumer_error.lepus` (with `error`) before the message is rejected. In Rails, `Lepus::LogSubscriber` logs both to `Lepus.logger`:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.2.1)
4
+ lepus (0.2.2)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.2.1)
4
+ lepus (0.2.2)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.2.1)
4
+ lepus (0.2.2)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lepus (0.2.1)
4
+ lepus (0.2.2)
5
5
  base64
6
6
  bunny
7
7
  concurrent-ruby
data/lib/lepus/cli.rb CHANGED
@@ -10,6 +10,7 @@ module Lepus
10
10
  method_option :logfile, type: :string, default: nil
11
11
  method_option :pidfile, type: :string, default: nil
12
12
  method_option :require_file, type: :string, aliases: "-r", default: nil
13
+ method_option :except, type: :array, default: nil, desc: "Consumers to leave out"
13
14
 
14
15
  desc "start FirstConsumer SecondConsumer ... NthConsumer", "Run Consumer"
15
16
  default_command :start
@@ -17,9 +18,10 @@ module Lepus
17
18
  def start(*consumers)
18
19
  opts = (@options || {}).transform_keys(&:to_sym)
19
20
 
20
- if (list = consumers.flat_map { |c| c.split(",") }.map(&:strip).uniq.sort).any?
21
+ if (list = consumer_names(consumers)).any?
21
22
  opts[:consumers] = list
22
23
  end
24
+ opts[:except] = consumer_names(opts[:except]) if opts[:except]
23
25
 
24
26
  if (logfile = opts.delete(:logfile))
25
27
  Lepus.logger = Logger.new(logfile)
@@ -78,5 +80,11 @@ module Lepus
78
80
  MSG
79
81
  end
80
82
  end
83
+
84
+ private
85
+
86
+ def consumer_names(names)
87
+ names.flat_map { |name| name.split(",") }.map(&:strip).reject(&:empty?).uniq.sort
88
+ end
81
89
  end
82
90
  end
@@ -21,11 +21,13 @@ module Lepus
21
21
  # @param pidfile [String] The path to the pidfile where the supervisor's PID will be stored. Default is "tmp/pids/lepus.pid".
22
22
  # @param shutdown_timeout [Integer] The timeout in seconds to wait for child processes to terminate gracefully before forcing termination. Default is 5 seconds.
23
23
  # @param consumers [Array<String, Class>] An optional list of consumer class names (as strings or constants) to be run by this supervisor. If not provided, all discovered consumer classes will be used.
24
+ # @param except [Array<String, Class>] An optional list of consumer class names (as strings or constants) to leave out.
24
25
  def initialize(require_file: nil, pidfile: "tmp/pids/lepus.pid", shutdown_timeout: 5, **kwargs)
25
26
  @pidfile_path = pidfile
26
27
  @require_file = require_file
27
28
  @shutdown_timeout = shutdown_timeout.to_i
28
29
  @consumer_class_names = Array(kwargs[:consumers]).map(&:to_s) if kwargs.key?(:consumers)
30
+ @excluded_consumer_names = Array(kwargs[:except]).map(&:to_s)
29
31
 
30
32
  @forks = {}
31
33
  @pipes = {}
@@ -79,7 +81,7 @@ module Lepus
79
81
  @consumer_class_names.map { |name| Lepus::Primitive::String.new(name).constantize }
80
82
  else
81
83
  Lepus::Consumer.descendants
82
- end.reject(&:abstract_class?)
84
+ end.reject { |klass| klass.abstract_class? || @excluded_consumer_names.include?(klass.name) }
83
85
  end
84
86
 
85
87
  def boot
data/lib/lepus/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lepus
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lepus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos G. Zimmermann