amqp-utils: AMQP toolset for the command line

[ gpl, network, program ] [ Propose Tags ]

AMQP tools consisting of: AMQP consumer which can create a temporary queue and attach it to an exchange, or attach to an existing queue; display header and body info; save message bodies to files; call a callback script. AMQP publisher with file, line-by-line and hotfolder capabilities. AMQP rpc client and server.


[Skip to Readme]

Downloads

Versions [RSS] 0.2.1.4, 0.2.1.5, 0.3.0.0, 0.3.2.0, 0.3.2.1, 0.3.3.1, 0.3.4.0, 0.3.6.0, 0.3.7.1, 0.4.0.0, 0.4.0.1, 0.4.1.0, 0.4.2.0, 0.4.3.0, 0.4.4.0, 0.4.4.1, 0.4.5.0, 0.4.5.1, 0.5.0.0, 0.6.0.0, 0.6.1.0, 0.6.1.1, 0.6.2.2, 0.6.3.2, 0.6.4.0
Change log ChangeLog.md
Dependencies amqp (>=0.19), base (>=4.6 && <5), bytestring, connection, containers, data-default-class, directory, hinotify (>=0.3.8), magic, network (>2.6), process, text, time, tls (>=1.3.9), unix (>=2.7), utf8-string, x509-system [details]
License GPL-3.0-only
Author Frank Doepper
Maintainer fd@taz.de
Category Network
Source repo head: git clone git://woffs.de/git/fd/haskell-amqp-utils.git
Uploaded by woffs at 2021-03-03T16:04:52Z
Distributions LTSHaskell:0.6.4.0, NixOS:0.6.4.0
Reverse Dependencies 1 direct, 0 indirect [details]
Executables arbeite, plane, agitprop, konsum
Downloads 11181 total (42 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2021-03-03 [all 3 reports]

Readme for amqp-utils-0.5.0.0

[back to package description]

haskell-amqp-utils

generic Haskell AMQP commandline tools for use with RabbitMQ

Repository access

Overview

The package contains 4 binaries for commandline use.

  • konsum, a generic consumer
  • agitprop, a generic publisher
  • arbeite, an rpc server
  • plane, an rpc client

konsum

usage

konsum [options]

Options:
  -r BINDINGKEY  --bindingkey=BINDINGKEY          AMQP binding key (default: #)
  -X[EXE]        --execute[=EXE]                  Callback Script File (implies -t) (-X without arg: /usr/lib/haskell-amqp-utils/callback)
  -a ARG         --args=ARG                       additional argument for -X callback
  -t[DIR]        --tempdir[=DIR], --target[=DIR]  tempdir (default: no file creation, -t without arg: /tmp)
  -f INT         --prefetch=INT                   Prefetch count. (0=unlimited, 1=off, default: 1)
  -A             --ack                            Toggle ack messages (default: True)
  -R             --requeuenack                    Toggle requeue when rejected (default: True)
  -l INT         --charlimit=INT                  limit number of shown body chars (default: unlimited)
  -q QUEUENAME   --queue=QUEUENAME                Ignore Exchange and bind to existing Queue
  -i             --simple                         call callback with one arg (filename) only
  -j             --cleanup                        Toggle remove tempfile after script call. Default False, but default True if --simple (-i)
  -Q TEMPQNAME   --qname=TEMPQNAME                Name for temporary exclusive Queue
  -x EXCHANGE    --exchange=EXCHANGE              AMQP Exchange (default: "")
  -o SERVER      --server=SERVER                  AMQP Server (default: localhost)
  -y VHOST       --vhost=VHOST                    AMQP Virtual Host (default: /)
  -p PORT        --port=PORT                      Server Port Number (default: 5672)
  -T             --tls                            Toggle TLS (default: False)
  -c CERTFILE    --cert=CERTFILE                  TLS Client Certificate File
  -k KEYFILE     --key=KEYFILE                    TLS Client Private Key File
  -U USERNAME    --user=USERNAME                  Username for Auth
  -P PASSWORD    --pass=PASSWORD                  Password for Auth
  -s INT         --heartbeats=INT                 heartbeat interval (0=disable, default: set by server)
  -n NAME        --name=NAME                      connection name, will be shown in RabbitMQ web interface
  -w SECONDS     --connect_timeout=SECONDS        timeout for establishing initial connection (default: 600)

examples

connect to localhost with default credentials and attach to a new temp queue on the default exchange (which will usually fail because attaching a queue to the default exchange is not allowed):

konsum

Connect to a host with TLS on a custom port, authenticating with SSL client certificate. On every received message a callback is spawned. The message will be ACKed when the callback exits successfully. First 500 bytes of the message body are printed to stderr. Header infos are always printed to stderr:

konsum -o amqp.example.com -p 5673 -T -k amqp-key.pem -c amqp-crt.pem -y vhost -x exchange -X./callback.sh -a -c -a callback.config.sh -f 2 -r routing.key.# -l 500

Authenticate with user and pass. Attach to an existing queue. Generate a file for every message:

konsum -o amqp.example.com -U user -P pass -q queue -t

Provide a custom CA cert for proving the server's identity via enviroment:

$ env SYSTEM_CERTIFICATE_PATH=/etc/amqp/cacert.crt konsum -T -y vhost -x exchange

Stop with ^C

agitprop

usage

agitprop [options]

Options:
  -r ROUTINGKEY    --routingkey=ROUTINGKEY            AMQP routing key
  -f INPUTFILE     --inputfile=INPUTFILE              Message input file (default: -)
  -l               --linemode                         Toggle line-by-line mode (default: False)
  -C               --confirm                          Toggle confirms (default: False)
                   --msgid=ID                         Message ID
                   --type=TYPE                        Message Type
                   --userid=USERID                    Message User-ID
                   --appid=APPID                      Message App-ID
                   --clusterid=CLUSTERID              Message Cluster-ID
                   --contenttype=CONTENTTYPE          Message Content-Type
                   --contentencoding=CONTENTENCODING  Message Content-Encoding
                   --replyto=REPLYTO                  Message Reply-To
                   --prio=PRIO                        Message Priority
                   --corrid=CORRID                    Message CorrelationID
                   --exp=EXP                          Message Expiration
  -h HEADER=VALUE  --header=HEADER=VALUE              Message Headers
  -F HEADERNAME    --fnheader=HEADERNAME              Put filename into this header
  -S SUFFIX        --suffix=SUFFIX                    Allowed file suffixes in hotfolder mode
  -u               --remove                           Toggle removal of sent file in hotfolder mode (default: False)
  -d               --dirscan                          Toggle initial directory scan in hotfolder mode (default: False)
  -m               --magic                            Toggle setting content-type and -encoding from file contents (default: False)
  -e               --persistent                       Set persistent delivery
  -E               --nonpersistent                    Set nonpersistent delivery
  -x EXCHANGE      --exchange=EXCHANGE                AMQP Exchange (default: "")
  -o SERVER        --server=SERVER                    AMQP Server (default: localhost)
  -y VHOST         --vhost=VHOST                      AMQP Virtual Host (default: /)
  -p PORT          --port=PORT                        Server Port Number (default: 5672)
  -T               --tls                              Toggle TLS (default: False)
  -c CERTFILE      --cert=CERTFILE                    TLS Client Certificate File
  -k KEYFILE       --key=KEYFILE                      TLS Client Private Key File
  -U USERNAME      --user=USERNAME                    Username for Auth
  -P PASSWORD      --pass=PASSWORD                    Password for Auth
  -s INT           --heartbeats=INT                   heartbeat interval (0=disable, default: set by server)
  -n NAME          --name=NAME                        connection name, will be shown in RabbitMQ web interface
  -w SECONDS       --connect_timeout=SECONDS          timeout for establishing initial connection (default: 600)

If INPUTFILE is a file, the file is sent as a message and the program exits. If INPUTFILE is a directory, the directory is watched via inotify ("hotfolder mode") and every file, which is written and closed or moved in gets sent, optionally only files which match one or several SUFFIXes. Optionally the file name is written into a message header named HEADERNAME. Optionally Content-Type and Content-Encoding headers are set via magic retrieved from file contents.

Line-by-line mode sends one message per INPUTFILE line.

examples

Send a message containing a file and put the filename into a fileName message header:

agitprop -x amq.topic -r test -F fileName -f agitprop.hs

plane

usage

plane [options]

Options:
  -f INPUTFILE     --inputfile=INPUTFILE      Message input file (default: -)
  -O OUTPUTFILE    --outputfile=OUTPUTFILE    Message output file (default: -)
  -t SECONDS       --rpc_timeout=SECONDS      How long to wait for reply (default: 5.0)
                   --corrid=CORRID            Message CorrelationID
                   --exp=EXP                  Message Expiration
  -h HEADER=VALUE  --header=HEADER=VALUE      Message Headers
  -l INT           --charlimit=INT            limit number of shown body chars (default: unlimited)
  -Q TEMPQNAME     --qname=TEMPQNAME          Name for temporary exclusive Queue
  -x EXCHANGE      --exchange=EXCHANGE        AMQP Exchange (default: "")
  -o SERVER        --server=SERVER            AMQP Server (default: localhost)
  -y VHOST         --vhost=VHOST              AMQP Virtual Host (default: /)
  -p PORT          --port=PORT                Server Port Number (default: 5672)
  -T               --tls                      Toggle TLS (default: False)
  -c CERTFILE      --cert=CERTFILE            TLS Client Certificate File
  -k KEYFILE       --key=KEYFILE              TLS Client Private Key File
  -U USERNAME      --user=USERNAME            Username for Auth
  -P PASSWORD      --pass=PASSWORD            Password for Auth
  -s INT           --heartbeats=INT           heartbeat interval (0=disable, default: set by server)
  -n NAME          --name=NAME                connection name, will be shown in RabbitMQ web interface
  -w SECONDS       --connect_timeout=SECONDS  timeout for establishing initial connection (default: 600)

examples

send "ls" to a remote worker and get the result:

echo ls | plane -o amqp.example.com -T -k amqp.pem -c amqp.pem -y myexchange -Q rpctest

arbeite

usage

arbeite [options]

Options:
  -X[EXE]       --execute[=EXE]                  Callback Script File (implies -t) (-X without arg: /usr/lib/haskell-amqp-utils/callback)
  -a ARG        --args=ARG                       additional argument for -X callback
  -t[DIR]       --tempdir[=DIR], --target[=DIR]  tempdir (default: no file creation, -t without arg: /tmp)
  -A            --ack                            Toggle ack messages (default: True)
  -R            --requeuenack                    Toggle requeue when rejected (default: True)
  -l INT        --charlimit=INT                  limit number of shown body chars (default: unlimited)
  -q QUEUENAME  --queue=QUEUENAME                Ignore Exchange and bind to existing Queue
  -i            --simple                         call callback with one arg (filename) only
  -j            --cleanup                        Toggle remove tempfile after script call. Default False, but default True if --simple (-i)
  -Q TEMPQNAME  --qname=TEMPQNAME                Name for temporary exclusive Queue
  -x EXCHANGE   --exchange=EXCHANGE              AMQP Exchange (default: "")
  -o SERVER     --server=SERVER                  AMQP Server (default: localhost)
  -y VHOST      --vhost=VHOST                    AMQP Virtual Host (default: /)
  -p PORT       --port=PORT                      Server Port Number (default: 5672)
  -T            --tls                            Toggle TLS (default: False)
  -c CERTFILE   --cert=CERTFILE                  TLS Client Certificate File
  -k KEYFILE    --key=KEYFILE                    TLS Client Private Key File
  -U USERNAME   --user=USERNAME                  Username for Auth
  -P PASSWORD   --pass=PASSWORD                  Password for Auth
  -s INT        --heartbeats=INT                 heartbeat interval (0=disable, default: set by server)
  -n NAME       --name=NAME                      connection name, will be shown in RabbitMQ web interface
  -w SECONDS    --connect_timeout=SECONDS        timeout for establishing initial connection (default: 600)

examples

provide shell access to a remote user. Very insecure! :-)

arbeite -o amqp.example.com -T -k amqp.pem -c amqp.pem -y myexchange -Q rpctest -i -Xsh