
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Sometimes it is difficult to know what goes on in your RabbitMQ exchanges. amqptap
is a CLI tool written in node.js that helps you get a better look at the messages that get passed around!
Install amqptap with npm install -g
and you should have the amqptap
executable accessible in your PATH
.
For a list of all options run amqptap --help
.
amqptap
creates an exclusive queue that is bound to the specified exchange, and will receive all messages on that exchange without interfering with other bound queues.
The server URL is specified using the -s
or --server
flag set to a value that corresponds to the RabbitMQ URI specification.
Almost feature-complete URL for connecting to foo.bar
using port 1234, vhost baz
, username tester
and password password
: amqp://tester:password@foo.bar:1234/baz
Without a specific server set, amqptap
attempts to connect to a RabbitMQ server running on localhost using the guest account.
Given a raw message output (see "Automatic deserialization") from amqplib coming on amq.topic
with routing key foo.bar
that looks like this.
{
"fields": {
"consumerTag": "amq.ctag-NFOFYLaMHMzMXD4PwHuLog",
"deliveryTag": 1,
"redelivered": false,
"exchange": "amq.topic",
"routingKey": "foo.bar"
},
"properties": {
"contentType": "application/json",
"headers": {
"test": 2
},
"deliveryMode": 1
},
"content": {
"hello": "world!"
}
}
Fields are picked using the flag -f
or --fields
with the notation of the lodash get function.
$ amqptap -f properties.deliveryMode
1
$ amqptap -f properties.contentType,fields.routingKey
{"properties.contentType": "application/json", "fields.routingKey": "foo.bar"}
The routing key can be set with the -r
or --route
flag.
$ amqptap -r "bar#"
The default exchange bound to is always amq.topic
. This can be changed with the -e
or --exchange
flag.
$ amqptap -e "amq.fanout"
amqptap
supports some inspectors with the -i
or --inspector
option that mutates the value before sending it to stdout.
$ amqptap -i eyes
"pretty colored output using npm package eyes"
$ amqptap -i json
"plain JSON output without indentation"
$ amqptap -i string
"output is passed through String()"
By default, raw buffers are returned for the content
field.
Messages with a contentType
header equal to application/json
or text/json
will have the content
field automatically parsed with JSON.parse
.
Messages with a contentType
header equal to text/plain
will be parsed with Buffer.prototype.toString
.
Running tests require guest access to a RabbitMQ server. The test runner is by default set to attempt a connection to amqp://localhost
but this value can be overriden by setting the environment variable AMQP_URL according to the RabbitMQ URI specification.
To run the tests, execute npm test
.
Most welcome by submitting pull requests to the repository.
FAQs
Tap output from AMQP exchanges
We found that amqptap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.