]> woffs.de Git - fd/haskell-amqp-utils.git/blob - doc/agitprop.md
release 0.6.6.0
[fd/haskell-amqp-utils.git] / doc / agitprop.md
1 <!--
2 SPDX-FileCopyrightText: 2022 Frank Doepper
3
4 SPDX-License-Identifier: FSFAP
5 -->
6
7 ---
8 title: agitprop
9 section: 1
10 header: haskell-amqp-utils
11 footer: haskell-amqp-utils 0.6.6.0
12 date: 2022-11-11
13 ---
14
15 # NAME
16 agitprop - an AMQP publisher
17
18 # SYNOPSIS
19 **agitprop** [*options*]
20
21 # DESCRIPTION
22
23 If INPUTFILE is a file, the file is sent as a message and the program exits. If
24 INPUTFILE is a directory, the directory is watched via inotify ("hotfolder
25 mode") and every file, which is written and closed or moved in gets sent,
26 optionally only files which match one or several SUFFIXes. Optionally the file
27 name is written into a message header named HEADERNAME.  Optionally
28 Content-Type and Content-Encoding headers are set via magic retrieved from file
29 contents.
30
31 Line-by-line mode sends one message per INPUTFILE line.
32
33 In "hotfolder mode" multiple directories can be watched and sent with distinct routingkeys.
34
35 # OPTIONS
36
37       -r ROUTINGKEY    --routingkey=ROUTINGKEY            AMQP routing key
38       -f INPUTFILE     --inputfile=INPUTFILE              Message input file (default: <stdin>)
39       -l               --linemode                         Toggle line-by-line mode (default: False)
40       -C               --confirm                          Toggle confirms (default: False)
41                        --msgid=ID                         Message ID
42                        --type=TYPE                        Message Type
43                        --userid=USERID                    Message User-ID
44                        --appid=APPID                      Message App-ID
45                        --clusterid=CLUSTERID              Message Cluster-ID
46                        --contenttype=CONTENTTYPE          Message Content-Type
47                        --contentencoding=CONTENTENCODING  Message Content-Encoding
48                        --replyto=REPLYTO                  Message Reply-To
49                        --prio=PRIO                        Message Priority
50                        --corrid=CORRID                    Message CorrelationID
51                        --exp=EXP                          Message Expiration
52       -h HEADER=VALUE  --header=HEADER=VALUE              Message Headers
53       -F HEADERNAME    --fnheader=HEADERNAME              Put filename into this header
54       -S SUFFIX        --suffix=SUFFIX                    Allowed file suffixes in hotfolder mode
55       -u[DIR]          --remove[=DIR], --move[=DIR]       Remove (or move to DIR) sent file in hotfolder mode
56       -d               --dirscan                          Toggle initial directory scan in hotfolder mode (default: False)
57       -m               --magic                            Toggle setting content-type and -encoding from file contents (default: False)
58       -e               --persistent                       Set persistent delivery
59       -E               --nonpersistent                    Set nonpersistent delivery
60       -x EXCHANGE      --exchange=EXCHANGE                AMQP Exchange (default: "")
61       -o SERVER        --server=SERVER                    AMQP Server (default: localhost)
62       -y VHOST         --vhost=VHOST                      AMQP Virtual Host (default: /)
63       -p PORT          --port=PORT                        Server Port Number (default: 5672)
64       -T               --tls                              Toggle TLS (default: False)
65       -c CERTFILE      --cert=CERTFILE                    TLS Client Certificate File
66       -k KEYFILE       --key=KEYFILE                      TLS Client Private Key File
67       -U USERNAME      --user=USERNAME                    Username for Auth
68       -P PASSWORD      --pass=PASSWORD                    Password for Auth
69       -s INT           --heartbeats=INT                   heartbeat interval (0=disable, default: set by server)
70       -n NAME          --name=NAME                        connection name, will be shown in RabbitMQ web interface
71       -w SECONDS       --connect_timeout=SECONDS          timeout for establishing initial connection (default: 600)
72 <!--
73 SPDX-FileCopyrightText: 2022 Frank Doepper
74
75 SPDX-License-Identifier: FSFAP
76 -->
77
78 # EXAMPLES
79
80 Send a message containing a file and put the filename into a fileName
81 message header:
82
83     agitprop -x amq.topic -r test -F fileName -f agitprop.hs
84
85 Watch two directories dir1 and dir2 and send files from dir1 with routingkey r1
86 and files from dir2 with routingkey r2, ignoring everything which is not *.txt
87 or *.zip, and set Content-Type and Content-Encoding automatically, and move all
88 sent files to subdir "done" (dir1/done and dir2/done, respectively):
89
90     agitprop -x amq.topic -F fileName -m -S .txt -S .zip -d -udone -r r1 -f dir1 -r r2 -f dir2
91