Giter Site home page Giter Site logo

rmqcat's Introduction

rmqcat

A netcat-like tool for sending things through RabbitMQ.

Installation

npm install -g rmqcat
rmqcat --help

Use

rmqcat has two modes of use, one-way and two-way ("duplex"). Duplex corresponds more or less to how netcat works, that is, it establishes a socket-like connection with a server ('listener') on one side and a client on the other, which can speak back and forth.

One-way (simplex) either relays stdin to a RabbitMQ queue, or from a RabbitMQ queue to stdout. Sending to a queue doesn't wait for a receiver; receiving from a queue waits for data in the queue.

Common to both modes

The option --url can be used to address a specific RabbitMQ server, and to provide connection parameters -- see the amqplib documentation. By default a RabbitMQ server on localhost is assumed, so you will probably want to supply --url in practice.

The option -D will make rmqcat output a bit of debug information to stderr.

The option --help, if present at all, will make rmqcat output a usage message to stderr then exit.

Duplex

# Start a listener that will put whatever it gets in a file
rmqcat -l > recv.txt

# Send a file to the listener
rmqcat < send.txt

rmqcat used this way will keep a connection open until it gets end-of-file, so you can use it to "chat" back and forth, similar to netcat.

A client (i.e., without -l) will buffer input until its connection is accepted by a listener.

The option -k in combination with -l will keep the listener accepting successive connections. Otherwise it will exit once the first connection closes.

The option -e or --exec causes rmqcat to spawn a child process using the remainder of the arguments, and redirect stdin and stdout of that process tthrough the queue. For example,

rmqcat -l --exec grep -n foo

If the option -k is used in combination with -e, the child process will be run for each connection made. In a client, the process is run once the connection is accepted.

The option --service has a role similar to a TCP port number. It names a queue to be used by clients and listeners to establish connections. The default is arbitrarily "rmqcat".

One-way

# Send a file to a queue
rmqcat --send bobbins < bobbins.iso

# Save the file in a queue and output the SHA1 sum
rmqcat --recv bobbins | tee bobbins.iso | shasum

The string following either --send or --recv names a queue that will hold the data in transit. More than one file of data can be present in the queue; rmqcat --recv <queue> will read a single file before exiting, or wait if there is no data yet.

rmqcat's People

Contributors

squaremo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.