omq 0.3.1 → 0.3.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +46 -0
- data/exe/omqcat +1 -0
- data/lib/omq/version.rb +1 -1
- data/lib/omq/zmtp/transport/ipc.rb +1 -1
- data/lib/omq/zmtp/transport/tcp.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27a1d700594261a36d3212b00ff84e15be3053a32db07a04a48aa0eb52fec902
|
|
4
|
+
data.tar.gz: 2797e4863af5cfcde9fe446c79929705e6ab17656ba016532b54d6c6b57564b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a116b039dc996a0099bbb86e8c138fd71f03051bd23c142b653e1c8e932e541245476bed51a47183ecb3723f9f86b30f36b6e3956b77494f8d77c924354f39ad
|
|
7
|
+
data.tar.gz: bdd7a62bb68390c942ebb1517981ca69d0efab007f3be7d3149fcccb525ad9b2cb279689ba2ec640db0f6057d6d7219e804074bb5ba4eb4d8339517bf6de5805
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -137,6 +137,52 @@ Benchmarked with benchmark-ips on Linux x86_64 (Ruby 4.0.1 +YJIT):
|
|
|
137
137
|
|
|
138
138
|
See [`bench/`](bench/) for full results and scripts.
|
|
139
139
|
|
|
140
|
+
## omqcat — CLI tool
|
|
141
|
+
|
|
142
|
+
`omqcat` is a command-line tool for sending and receiving messages on any OMQ socket. Like `nngcat` from libnng, but with Ruby superpowers.
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
# Echo server in one line
|
|
146
|
+
omqcat rep -b tcp://:5555 -e '$F.map(&:upcase)'
|
|
147
|
+
|
|
148
|
+
# Client
|
|
149
|
+
echo "hello" | omqcat req -c tcp://localhost:5555
|
|
150
|
+
# => HELLO
|
|
151
|
+
|
|
152
|
+
# PUB/SUB
|
|
153
|
+
omqcat sub -b tcp://:5556 -s "weather." &
|
|
154
|
+
echo "weather.nyc 72F" | omqcat pub -c tcp://localhost:5556 -d 0.3
|
|
155
|
+
|
|
156
|
+
# Pipeline with filtering
|
|
157
|
+
tail -f /var/log/syslog | omqcat push -c tcp://collector:5557
|
|
158
|
+
omqcat pull -b tcp://:5557 -e '$F.first.include?("error") ? $F : nil'
|
|
159
|
+
|
|
160
|
+
# Multipart messages via tabs
|
|
161
|
+
printf "routing-key\tpayload data" | omqcat push -c tcp://localhost:5557
|
|
162
|
+
omqcat pull -b tcp://:5557
|
|
163
|
+
# => routing-key payload data
|
|
164
|
+
|
|
165
|
+
# JSONL for structured data
|
|
166
|
+
echo '["key","value"]' | omqcat push -c tcp://localhost:5557 -J
|
|
167
|
+
omqcat pull -b tcp://:5557 -J
|
|
168
|
+
|
|
169
|
+
# Zstandard compression
|
|
170
|
+
omqcat push -c tcp://remote:5557 -z < data.txt
|
|
171
|
+
omqcat pull -b tcp://:5557 -z
|
|
172
|
+
|
|
173
|
+
# CURVE encryption (auto-detected from env vars)
|
|
174
|
+
SERVER_KEY=... omqcat req -c tcp://secure:5555 -D "secret"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The `-e` flag runs Ruby inside the socket instance — the full socket API (`self <<`, `send`, `subscribe`, ...) is available. Use `-r` to require gems:
|
|
178
|
+
|
|
179
|
+
```sh
|
|
180
|
+
omqcat sub -c tcp://localhost:5556 -s "" -r json \
|
|
181
|
+
-e 'JSON.parse($F.first)["temperature"]'
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Formats: `--ascii` (default, tab-separated), `--quoted`, `--raw`, `--jsonl`, `--msgpack`. See `omqcat --help` for all options.
|
|
185
|
+
|
|
140
186
|
## Interop with native ZMQ
|
|
141
187
|
|
|
142
188
|
OMQ speaks ZMTP 3.1 on the wire and interoperates with libzmq, CZMQ, pyzmq, etc. over **tcp** and **ipc**. The `inproc://` transport is OMQ-internal (in-process Ruby queues) and is not visible to native ZMQ running in the same process — use `ipc://` to talk across library boundaries.
|
data/exe/omqcat
CHANGED
data/lib/omq/version.rb
CHANGED
|
@@ -35,7 +35,7 @@ module OMQ
|
|
|
35
35
|
engine.handle_accepted(IO::Stream::Buffered.wrap(client, minimum_write_size: 0), endpoint: endpoint)
|
|
36
36
|
rescue ProtocolError, *ZMTP::CONNECTION_LOST
|
|
37
37
|
# peer disconnected during handshake
|
|
38
|
-
rescue
|
|
38
|
+
rescue
|
|
39
39
|
client&.close rescue nil
|
|
40
40
|
raise
|
|
41
41
|
end
|
|
@@ -32,7 +32,7 @@ module OMQ
|
|
|
32
32
|
engine.handle_accepted(IO::Stream::Buffered.wrap(client, minimum_write_size: 0), endpoint: resolved)
|
|
33
33
|
rescue ProtocolError, *ZMTP::CONNECTION_LOST
|
|
34
34
|
# peer disconnected during handshake
|
|
35
|
-
rescue
|
|
35
|
+
rescue
|
|
36
36
|
client&.close rescue nil
|
|
37
37
|
raise
|
|
38
38
|
end
|