mqta 0.1.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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +39 -0
- data/README.md +51 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/mqta +47 -0
- data/bin/setup +8 -0
- data/lib/mqta/version.rb +3 -0
- data/mqta.gemspec +29 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 95e0609516bc5ca963287e38a39ec589d671816e7379e47e099346dbfaab6675
|
4
|
+
data.tar.gz: 6d538ab381cbbb634dd78b2c37e13dd2fe0663a4ace03672a17de2078ca030bd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 915182cccbdeebc0225303d66ce80a05f6dc7ea7740d7bb736702c2b26e3622ae6f7c52734a423886011226e3208512be7286f22d5e87536228be66ad13ed906
|
7
|
+
data.tar.gz: c03898b2ca0f4c608e51be1e47048833c331ac25d28572464951a53fea72dd1502bbcd1372b5ed7db185a82aa28574c80c8c6e860ffac64c967e3e4df64b22d8
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mqta (0.1.0)
|
5
|
+
bunny (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
amq-protocol (2.3.0)
|
11
|
+
bunny (2.9.2)
|
12
|
+
amq-protocol (~> 2.3.0)
|
13
|
+
diff-lcs (1.3)
|
14
|
+
rake (10.5.0)
|
15
|
+
rspec (3.8.0)
|
16
|
+
rspec-core (~> 3.8.0)
|
17
|
+
rspec-expectations (~> 3.8.0)
|
18
|
+
rspec-mocks (~> 3.8.0)
|
19
|
+
rspec-core (3.8.1)
|
20
|
+
rspec-support (~> 3.8.0)
|
21
|
+
rspec-expectations (3.8.4)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.8.0)
|
24
|
+
rspec-mocks (3.8.1)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.8.0)
|
27
|
+
rspec-support (3.8.2)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (~> 2.0)
|
34
|
+
mqta!
|
35
|
+
rake (~> 10.0)
|
36
|
+
rspec (~> 3.0)
|
37
|
+
|
38
|
+
BUNDLED WITH
|
39
|
+
2.0.1
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# mqta
|
2
|
+
|
3
|
+
This is a small tool for visualizing what's flowing on an AMQP exchange
|
4
|
+
(e.g RabbitMQ). It will output to stdout.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install mqta
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
You need to specify ENV vars with the credentials for accessing the AMQP exchange.
|
13
|
+
|
14
|
+
```
|
15
|
+
EXCHANGE=exchange-name HOST=host USER=user VHOST=vhost PASSWORD=password mqta"
|
16
|
+
```
|
17
|
+
|
18
|
+
where `EXCHANGE` is the name of the exchange you want to see on the screen.
|
19
|
+
|
20
|
+
This will block and show every message that the exchange receives, by creating a
|
21
|
+
temporary queue bound to that exchange.
|
22
|
+
|
23
|
+
#### Tips
|
24
|
+
|
25
|
+
**Alias per project:** if you're on a particular project, define an alias:
|
26
|
+
|
27
|
+
```
|
28
|
+
alias mqta_my_project="HOST=host USER=user VHOST=vhost PASSWORD=password mqta"
|
29
|
+
```
|
30
|
+
|
31
|
+
Then call your alias with `EXCHANGE=my-project mqta_my_project`.
|
32
|
+
|
33
|
+
**Format JSON Payloads:** if the exchange gets JSON messages, you can format
|
34
|
+
them with `jq` (e.g `brew install jq` on the MacOS).
|
35
|
+
|
36
|
+
```
|
37
|
+
EXCHANGE=my-project mqta_my_project | jq '.some-key | .[] | { key: .some-other-key }'
|
38
|
+
```
|
39
|
+
|
40
|
+
This will pipe every message into `jq`. This tool will allow you to select
|
41
|
+
exactly what you need without having to explode your terminal with so much text.
|
42
|
+
|
43
|
+
**First N chars:** if you don't want to see all the data and don't care about
|
44
|
+
JSON, you can limit the number of chars per line with
|
45
|
+
`EXCHANGE=my-project mqta_my_project | cut -c 1-160` (replace `160` with the
|
46
|
+
number of chars you want).
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
It's basically a bin script at `bin/mqta`, so there's not much to see here for
|
51
|
+
now. If the features set grows, I'll organize it in classes.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mqta"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/mqta
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "bunny"
|
6
|
+
|
7
|
+
STDOUT.sync = true
|
8
|
+
queue_name = "mqta-debug #{Time.now.to_i}"
|
9
|
+
|
10
|
+
config = {
|
11
|
+
host: ENV.fetch('HOST'),
|
12
|
+
vhost: ENV.fetch('VHOST'),
|
13
|
+
user: ENV.fetch('USER'),
|
14
|
+
password: ENV.fetch('PASSWORD'),
|
15
|
+
exchange: ENV.fetch('EXCHANGE'),
|
16
|
+
# queue:
|
17
|
+
#durable: true
|
18
|
+
#port:
|
19
|
+
}
|
20
|
+
|
21
|
+
conn = Bunny.new(
|
22
|
+
host: config[:host],
|
23
|
+
vhost: config[:vhost],
|
24
|
+
user: config[:user],
|
25
|
+
password: config[:password]
|
26
|
+
)
|
27
|
+
conn.start
|
28
|
+
|
29
|
+
channel = conn.create_channel
|
30
|
+
exchange = channel.fanout(config[:exchange])
|
31
|
+
log_channel = channel.queue(queue_name, :auto_delete => true)
|
32
|
+
log_channel = log_channel.bind(exchange)
|
33
|
+
|
34
|
+
log_channel.subscribe do |delivery_info, metadata, payload|
|
35
|
+
begin
|
36
|
+
$stdout.puts payload
|
37
|
+
rescue Errno::EPIPE
|
38
|
+
# Support Unix Pipe
|
39
|
+
exit(74)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
loop do
|
44
|
+
sleep 5
|
45
|
+
end
|
46
|
+
conn.close
|
47
|
+
|
data/bin/setup
ADDED
data/lib/mqta/version.rb
ADDED
data/mqta.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "mqta/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mqta"
|
8
|
+
spec.version = Mqta::VERSION
|
9
|
+
spec.authors = ["Alex Oliveira"]
|
10
|
+
spec.email = ["kurko@users.noreply.github.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Log messages from a RabbitMQ exchange.}
|
13
|
+
spec.description = %q{Log messages from a RabbitMQ exchange.}
|
14
|
+
spec.homepage = "https://github.com/kurko/mqta"
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = "bin"
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_dependency "bunny", "~> 2.0"
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mqta
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex Oliveira
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bunny
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: Log messages from a RabbitMQ exchange.
|
70
|
+
email:
|
71
|
+
- kurko@users.noreply.github.com
|
72
|
+
executables:
|
73
|
+
- console
|
74
|
+
- mqta
|
75
|
+
- setup
|
76
|
+
extensions: []
|
77
|
+
extra_rdoc_files: []
|
78
|
+
files:
|
79
|
+
- ".gitignore"
|
80
|
+
- ".rspec"
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/mqta
|
87
|
+
- bin/setup
|
88
|
+
- lib/mqta/version.rb
|
89
|
+
- mqta.gemspec
|
90
|
+
homepage: https://github.com/kurko/mqta
|
91
|
+
licenses: []
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubygems_version: 3.0.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Log messages from a RabbitMQ exchange.
|
112
|
+
test_files: []
|