omq-cli 0.14.8 → 0.14.9

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: 108eeb712d98cda6762591002a5a7a6e24d341b579c6f9734f5a8d78adb2e481
4
- data.tar.gz: a603b8c354cb14b6cfa8aed2a13798f9e9a51ecf34c31ab83b6119a36e9a88bb
3
+ metadata.gz: 8c74ab7e19208ffaf2f5972c84a5242c7073cd8afb7ed41e99c2bfe3f2af7768
4
+ data.tar.gz: 117afb7dd5d1a97326076662e8de8d20be3d356ddcbc206049dd520ab661536c
5
5
  SHA512:
6
- metadata.gz: 03210f226733ee6baa9acf26fc5e37617dbe6ca8040bd73529701d60994999d1a0baa8571b10852654892e1add49333c6c8bc38c442d91a349c4c0e49a749379
7
- data.tar.gz: bfd7327cb515ae2133de3ec152b3c6f7ee5c68398b74f46fbd00d4ae060569bc782d4332e043e4b9eb1f0a53dd0ba5fa33ab84a72c322708e3aceee5febaad89
6
+ metadata.gz: 3a33546f35f48b8bf0c260483dc7517de1a469f322fd0555d4a55ea209dc5205c9a6bb260d2e4c88e70a367eb9b1768bcda8ca7b450e12878407c0b33cd5be05
7
+ data.tar.gz: d83a5925baf4342047b2a8bd9747b6ae40ba76d59dbc690ba2a8a2627799db6365828a0a7ba71ff2921d7c74e8f28a7b865f2477d41a9ff6cbc711e3ddab49a3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.9 — 2026-04-14
4
+
5
+ ### Fixed
6
+
7
+ - **Bind-mode one-shot senders now wait for a peer before firing.**
8
+ `omq push -b tcp://:5050 -ME '"foo"*3'` used to bind, queue the
9
+ message into HWM, close the socket, and exit — frequently before
10
+ any PULL had even connected, surfacing as a mysterious
11
+ linger-timeout on exit. `needs_peer_wait?` now also returns true
12
+ for bind-mode senders whose send plan is bounded or scheduled
13
+ (`-d` / `-f` / `-E` / `-i`), so the runner blocks on
14
+ `peer_connected.wait` before sending and then drains cleanly via
15
+ linger on close. Interactive stdin is unchanged — typing isn't
16
+ gated on a peer.
17
+ - **`--count N` now works with `-d` / `-f` / `-E` one-shot sends.**
18
+ Previously only `-i` / stdin respected `--count`; a pure-generator
19
+ run fired exactly once regardless. The `-d`/`-f` and `-E` branches
20
+ in `run_send_logic` now loop `n` times (default 1).
21
+ - **`^C` while paging `--examples` is quiet.** Hitting ^C in the
22
+ pager used to leak an `Interrupt` stack trace from `IO.popen`;
23
+ `CLI.page` now rescues `Interrupt` alongside `Errno::EPIPE`.
24
+
25
+ ### Changed
26
+
27
+ - **`--examples` output is ASCII-only and tightened up.** Replaced
28
+ the two em-dashes in the Marshal section with ASCII parentheses,
29
+ added a note to the Pipe section explaining that `@work` /
30
+ `@sink` are Linux abstract-namespace unix sockets
31
+ (`ipc://@name`), Linux-only, and to fall back to `ipc:///tmp/…`
32
+ on macOS/BSD. Marshal and Compression prose trimmed from
33
+ paragraph form to 2-3 line summaries.
34
+
3
35
  ## 0.14.8 — 2026-04-14
4
36
 
5
37
  ### Changed
@@ -141,7 +141,21 @@ module OMQ
141
141
 
142
142
 
143
143
  def needs_peer_wait?
144
- !config.recv_only? && (config.connects.any? || config.type_name == "router")
144
+ return false if config.recv_only?
145
+ return true if config.connects.any?
146
+ return true if config.type_name == "router"
147
+
148
+ # Bind-mode senders with a bounded or scheduled send plan:
149
+ # wait for the first peer so a one-shot `-d` / `-E` doesn't
150
+ # just queue into HWM and then exit before anyone is
151
+ # listening. Interactive stdin still goes through unwaited
152
+ # so typing isn't gated on a peer.
153
+ config.binds.any? && bounded_or_scheduled_send?
154
+ end
155
+
156
+
157
+ def bounded_or_scheduled_send?
158
+ config.interval || config.data || config.file || @send_eval_proc
145
159
  end
146
160
 
147
161
 
@@ -205,14 +219,18 @@ module OMQ
205
219
  if config.interval
206
220
  run_interval_send(n)
207
221
  elsif config.data || config.file
222
+ # One-shot from -d/-f. --count N fires the same payload N times.
208
223
  parts = eval_send_expr(read_next)
209
- send_msg(parts) if parts
224
+ (n && n > 0 ? n : 1).times { send_msg(parts) } if parts
210
225
  elsif stdin_ready?
211
226
  run_stdin_send(n)
212
227
  elsif @send_eval_proc
213
- # Pure generator: -e/-E with no stdin input, fire once.
214
- parts = eval_send_expr(nil)
215
- send_msg(parts) if parts
228
+ # Pure generator: -e/-E with no stdin input. Fire once by
229
+ # default, --count N fires N times.
230
+ (n && n > 0 ? n : 1).times do
231
+ parts = eval_send_expr(nil)
232
+ send_msg(parts) if parts
233
+ end
216
234
  elsif config.stdin_is_tty
217
235
  # Bare interactive invocation on a terminal: read lines from
218
236
  # the tty until the user hits ^D.
@@ -75,10 +75,15 @@ module OMQ
75
75
  | PUSH |-------->| pipe |-------->| PULL |
76
76
  +------+ +------+ +------+
77
77
 
78
+ # @work / @sink below are Linux abstract-namespace unix
79
+ # sockets (ipc://@name) -- no path on disk, cleaned up
80
+ # automatically. Linux only. Use ipc:///tmp/work etc.
81
+ # on macOS/BSD.
82
+
78
83
  # terminal 1: producer
79
84
  echo -e "hello\nworld" | omq push -b@work
80
85
 
81
- # terminal 2: worker -- uppercase each message
86
+ # terminal 2: worker (uppercase each message)
82
87
  omq pipe -c@work -c@sink -e 'it.map(&:upcase)'
83
88
  # terminal 3: collector
84
89
  omq pull -b@sink
@@ -89,10 +94,10 @@ module OMQ
89
94
  # exit when producer disconnects (--transient)
90
95
  omq pipe -c@work -c@sink --transient -e 'it.map(&:upcase)'
91
96
 
92
- # fan-in: multiple sources -> one sink
97
+ # fan-in (multiple sources -> one sink)
93
98
  omq pipe --in -c@work1 -c@work2 --out -c@sink -e 'it.map(&:upcase)'
94
99
 
95
- # fan-out: one source -> multiple sinks (round-robin)
100
+ # fan-out (one source -> multiple sinks, round-robin)
96
101
  omq pipe --in -b tcp://:5555 --out -c@sink1 -c@sink2 -e 'it'
97
102
 
98
103
  -- CLIENT / SERVER (draft) ----------------------------------
@@ -125,15 +130,13 @@ module OMQ
125
130
 
126
131
  -- Marshal (arbitrary Ruby objects) -------------------------
127
132
 
128
- # With -M, each message on the wire is one Marshal-dumped
129
- # Ruby object. Inside -e/-E, `it` is that raw object not
130
- # an Array of frames — so you can send/receive scalars,
131
- # hashes, custom classes, whatever Marshal handles.
133
+ # -M: each message is one Marshal-dumped Ruby object.
134
+ # Inside -e/-E, `it` is the raw object (not an Array).
132
135
 
133
- # send a bare string, receive a { string => encoding } hash
134
- omq push -b tcp://:5557 -ME '"foo"'
135
- omq pull -c tcp://:5557 -Mvvv -e '{it => it.encoding}'
136
- # output: {"foo" => #<Encoding:UTF-8>}
136
+ # send a bare string; receiver transforms it to { string => encoding } hash
137
+ omq push -b tcp://:5557 -ME '"foo" * 3'
138
+ omq pull -c tcp://:5557 -Me '{it => it.encoding}'
139
+ # output: {"foofoofoo" => #<Encoding:UTF-8>}
137
140
 
138
141
  # -vvv traces render the app object, not wire bytes
139
142
  omq push -b tcp://:5557 -ME '{now: Time.now, pid: Process.pid}' -vvv
@@ -141,11 +144,9 @@ module OMQ
141
144
 
142
145
  -- Compression ----------------------------------------------
143
146
 
144
- # ZMTP-Zstd is negotiated transparently during the handshake.
145
- # Receive-capable sockets (pull, sub, rep, ...) advertise the
146
- # profile by default in passive mode: they decode compressed
147
- # frames from an active sender but never compress their own
148
- # outgoing frames. Use -z / -Z on the sender to opt it in.
147
+ # ZMTP-Zstd is negotiated during the handshake.
148
+ # Recv sockets advertise it passively by default.
149
+ # Use -z on the sender to compress outgoing frames.
149
150
  omq pull --bind tcp://:5557 &
150
151
  echo "compressible data" | omq push --connect tcp://localhost:5557 -z
151
152
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OMQ
4
4
  module CLI
5
- VERSION = "0.14.8"
5
+ VERSION = "0.14.9"
6
6
  end
7
7
  end
data/lib/omq/cli.rb CHANGED
@@ -97,8 +97,8 @@ module OMQ
97
97
  end
98
98
  rescue Errno::ENOENT
99
99
  puts text
100
- rescue Errno::EPIPE
101
- # user quit pager early
100
+ rescue Errno::EPIPE, Interrupt
101
+ # user quit pager early (q) or hit ^C while paging
102
102
  end
103
103
 
104
104
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.8
4
+ version: 0.14.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger