aboutsummaryrefslogtreecommitdiffstats
path: root/man/psmq-sub.1
blob: 0298593564999c3fea374139d93d4dedb577a546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
.TH "psmq-sub" "1" "19 May 2021 (v9999)" "bofc.pl"
.SH NAME
.PP
.B psmq-sub
- helper tool to listen to subscribed messages over psmq.
.SH SYNOPSIS
.PP
.B psmq-sub
[
.B -h
|
.B -v
]
.br
.B psmq-sub
.RB [< -n
.IR mqueue-name >]
.RB < -b
.IR name >
.RB < -t
.IR topic >
.RB [< -t
.IR topic >]
.RB [ -o
.IR file ]
.SH DESCRIPTION
.TP
.B -h
Prints short help and exits
.TP
.B -v
Prints version information and exits
.TP
.BI -n\  mqueue-name
.B psmq-sub
will create and use to communicate with broker.
This argument is optional and by default
.B /psmq-sub
will be used.
If you want to use custom
.IR mqueue-name ,
then this argument must be the first one you pass.
.TP
.BI -b\  name
mqueue
.I name
of the broker you want to use for communication.
This options is mandatory and must be passed after (if set)
.B -n
argument and before
.BR -t .
.TP
.BI -t\  topic
.I topic
you want to subscribe to.
At least one
.I topic
must be passed.
You can subscribe to as many topics as you want by passing multiple
.B -t
options.
.TP
.BI -o\  path
.I Path
to a file, where logs from incoming messages shall be stored.
If file cannot be opened, program will refuse to start.
Optional argument, if not passed, messages will be printed to
.BR stdout .
.PP
Data will be printed in two ways depending on type of data received.
When received data is simple ascii string, payload will be printed
in the same line as info, thus one line per received message will
be received.
When data contains
.B non-printable
character, output will be hexdump like.
.PP
Line is printed in format:
.br
.BI p: n
.I topic
.BI data( llll ): payload
.TP
.BI p: n
is a priority number
.TP
.I topic
is a topic message was published on
.TP
.BI ( llll )
number of bytes in payload
.TP
.I payload
received payload
.PP
Check following example to better understand the format.
Output is a snippet from a source code, sixth line is printed in binary
since it contains utf8 character which encoding contain non-printable
charater.
Rest of lines are printed in single line as a string.
.PP
.nf
    p:0 /source data(  37):     switch (psmqd_cfg_init(argc, argv))
    p:0 /source data(   3):     {
    p:0 /source data(   9):     case 0:
    p:0 /source data(  37):             /* no errors in parsing arguments,
    p:0 /source data(  32):              * continue program execution
    p:0 /source data(40)
    0x0000  09 09 20 2a 20 75 74 66 2d 38 20 61 74 74 61 63  .. * utf-8 attac
    0x0010  6b 2c 20 68 65 72 65 20 69 74 20 63 6f 6d 65 73  k, here it comes
    0x0020  21 20 c5 82 20 2a 2f 00                          ! .. */.
    p:0 /source data(   9):             break;
    p:0 /source data(   1):
    p:0 /source data(  10):     case -2:
    p:0 /source data(  10):     case -3:
    p:0 /source data(  39):             /* help or version was printed, exit
    p:0 /source data(  30):              * program without error */
    p:0 /source data(  12):             return 0;
    p:0 /source data(   1):
    p:0 /source data(  10):     default:
    p:0 /source data(  32):             /* error occured when parsing
    p:0 /source data(  23):              * arguments, die */
    p:0 /source data(  12):             return 1;
    p:0 /source data(   3):     }
fi
.SH EXAMPLES
.TP
Listen to single topic
.B psmq-sub
-b/brok -t/topic1
.TP
Listen on multiple topics, use custom mqueue name
.B psmq-sub
-n/qsubnam -b/brok -t/topic1 -t/topic2/+ -t/topic3/subtopic2/*
.TP
Log every topic into file
.B psmq-sub
-b/brok -t/* -o/var/log/psmq-log
.SH "BUG REPORTING"
.PP
Please, report all bugs to "Michał Łyszczek <michal.lyszczek@bofc.pl>"
.SH "SEE ALSO"
.PP
.BR psmqd (1),
.BR psmq-pub (1),
.BR psmq-sub (1),
.BR psmq_cleanup (3),
.BR psmq_init (3),
.BR psmq_publish (3),
.BR psmq_receive (3),
.BR psmq_subscribe (3),
.BR psmq_timedreceive (3),
.BR psmq_timedreceive_ms (3),
.BR psmq_unsubscribe (3),
.BR psmq_building (7),
.BR psmq_overview (7).