summaryrefslogtreecommitdiff
path: root/java/tools/bin/qpid-jms-send
blob: d7695924f035e83f999acb562d42992007c851f4 (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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

# This starts the controller for coordinating perf tests/

. check-qpid-java-env

PROGRAM_NAME="qpid-jms-send"
URL="amqp://guest:guest@clientid/testpath?brokerlist='tcp://localhost:5672'"
ADDRESS="queue;{create:always}"
MESSAGES="1"
ID=""
REPLY_TO=""
SEND_EOS="1"
DURABLE="false"
TTL="0"
PRIORITY="0"
PROPERTY=""
CORRELATION_ID=""
USER_ID=""
CONTENT_STRING=""
CONTENT_SIZE="1024"
CONTENT_MAP=""
CAPACITY="1000"
ACK_FREQUENCY="100"
TX="0"
ROLLBACL_FREQUENCY="0"
PRINT_CONTENT="true"
PRINT_HEADERS="false"
REPORT_TOTAL="false"
REPORT_EVERY="0"
REPORT_HEADER="true"
SEND_RATE="-1"
SEQUNCE="1"
DISABLE_TIMESTAMP="false"
EXTRA_JVM_ARGS=""
VERBOSE="0"

TEST_ID=`echo ${HOSTNAME} |  awk -F . '{print $1}'`

TEMP=$(getopt -n $PROGRAM_NAME -o b:a:m:i:P:M:vh\
 --long broker:,address:,messages:,id:,reply-to:\
,send-eos:,durable:,ttl:,property:,correlational-id:\
,user-id:,content-string:,content-size:,content-map:\
,capacity:,ack-frequency:,tx:,rollback-frequency:\
,print-content:,print-headers:,report-total\
,report-every:,report-header:,send-rate:,sequence:,timestamp:\
,jvm-args:,verbose,help -- "$@")                                                            

# padding the option string with 4 spaces
# padding the desc string with 30 spaces
usage()
{
  printf "\n%s\n" "Usage: $PROGRAM_NAME [option].."

  printf "\n%20s\n%57s\n"  "-b, --broker URL" "url of broker to connect to"

  printf "\n%24s\n%53s\n"  "-a,--address ADDRESS" "address to receive from"

  printf "\n%24s\n%89s\n"  "-m, --messages N (0)" "Number of messages to receive; 0 means receive indefinitely"

  printf "\n%15s\n%75s\n"  "-i, --id ID" "use the supplied id instead of generating one"

  printf "\n%23s\n%54s\n"  "--reply-to REPLY-TO" "specify reply-to address"

  printf "\n%20s\n%70s\n"  "--send-eos N (0)" "send N EOS messages to mark end of input"

  printf "\n%24s\n%54s\n"  "--durable yes|no (0)" "mark messages as durable"

  printf "\n%19s\n%72s\n"  "--ttl msecs (0)" "time-to-live for messages, in milliseconds"

  printf "\n%27s\n%72s\n"  "--priority PRIORITY (0)" "time-to-live for messages, in milliseconds"

  printf "\n%29s\n%54s\n"  "-P, --property NAME=VALUE" "specify message property"

  printf "\n%23s\n%57s\n"  "--correlation-id ID" "correlation-id for message"

  printf "\n%20s\n%48s\n"  "--user-id USERID" "userid for message"

  printf "\n%28s\n%60s\n"  "--content-string CONTENT" "use CONTENT as message content"

  printf "\n%24s\n%62s\n"  "--content-size N (0)" "create an N-byte message content"

  printf "\n%32s\n%59s\n"  "-M, --content-map NAME=VALUE" "specify entry for map content"

  printf "\n%23s\n%71s\n"  "--capacity N (1000)" "Pre-fetch window (0 implies no pre-fetch)"

  printf "\n%27s\n%94s\n"  "--ack-frequency N (100)" "Ack frequency (0 implies none of the messages will get accepted)"

  printf "\n%14s\n%94s\n"  "--tx N (0)" "batch size for transactions (0 implies transaction are not used)"

  printf "\n%30s\n%94s\n"  "--rollback-frequency N (0)" "rollback frequency (0 implies no transaction will be rolledback)"

  printf "\n%30s\n%55s\n"  "--print-content yes|no (1)" "print out message content"

  printf "\n%30s\n%55s\n"  "--print-headers yes|no (0)" "print out message headers"

  printf "\n%18s\n%76s\n"  "--report-total" "Report total throughput and latency statistics"

  printf "\n%24s\n%87s\n"  "--report-every N (0)" "Report throughput and latency statistics every N messages"

  printf "\n%30s\n%47s\n"  "--report-header yes|no (1)" "Headers on report"

  printf "\n%21s\n%64s\n%62s\n"  "--send-rate N (0)" "Send at rate of N messages/second." "0 means send as fast as possible"

  printf "\n%25s\n%69s\n%77s\n"  "--sequence yes|no (1)" "Add a sequence number messages property" "(required for duplicate/lost message detection)"

  printf "\n%26s\n%64s\n%77s\n"  "--timestamp yes|no (1)" "Add a time stamp messages property" "(required for duplicate/lost message detection)"

  printf "\n%14s\n%69s\n"  "--jvm-args" "Extra jvm arguments you want to specify"

  printf "\n%17s\n%69s\n\n"  "-v, --verbose" "Print debug information for this script"
}

eval set -- "$TEMP"
while true; do     
        case $1 in
                -b|--broker)
                        URL="$2"; shift; shift; continue
                ;;
                -a|--address)
                        ADDRESS="$2"; shift; shift; continue
                ;;
                -m|--messages)
                        MESSAGES="$2"; shift; shift; continue
                ;;
                -i|--id)
                        ID="$2"; shift; shift; continue
                ;;
                --reply-to)
                        REPLY_TO="$2"; shift; shift; continue
                ;;
                --send-eos)
                        SEND_EOS="$2"; shift; shift; continue
                ;;
                --durable)
                        if [ "$2" == "1" ]; then DURABLE="true"; else DURABLE="false"; fi; shift; shift; continue
                ;;
                --ttl)
                        TTL="$2"; shift; shift; continue
                ;;
                --priority)
                        PRIORITY="$2"; shift; shift; continue
                ;;
                -P|--property)
                        PROPERTY="$2,$PROPERTY"; shift; shift; continue
                ;;
                --correlation-id)
                        CORRELATION_ID="$2"; shift; shift; continue
                ;;
                --user-id)
                        USER_ID="$2"; shift; shift; continue
                ;;
                --content-string)
                        CONTENT_STRING="$2"; shift; shift; continue
                ;;
                --content-size)
                        CONTENT_SIZE="$2"; shift; shift; continue
                ;;
                -M|--content-map)
                        CONTENT_MAP="$2,$CONTENT_MAP"; shift; shift; continue
                ;;
                --capacity)
                        CAPACITY="$2"; shift; shift; continue
                ;;
                --ack-frequency)
                        ACK_FREQUENCY="$2"; shift; shift; continue
                ;;
                --tx)
                        TX="$2"; shift; shift; continue
                ;;
                --rollback-frequency)
                        ROLLBACK_FREQUENCY="$2"; shift; shift; continue
                ;;
                --print-content)
                        if [ "$2" == "yes" ]; then PRINT_CONTENT="true"; else PRINT_CONTENT="false"; fi; shift; shift; continue
                ;;
                --print-headers)
                        if [ "$2" == "yes" ]; then PRINT_HEADERS="true"; else PRINT_HEADERS="false"; fi; shift; shift; continue
                ;;
                --report-total)
                        REPORT_TOTAL="true"; shift; continue
                ;;
                --report-every)
                        REPORT_EVERY="$2"; shift; shift; continue
                ;;
                --report-header)
                        if [ "$2" == "yes" ]; then REPORT_HEADER="true"; else REPORT_HEADER="false"; fi; shift; shift; continue
                ;;
                --send-rate)
                        SEND_RATE="$2"; shift; shift; continue
                ;;
                --sequence)
                        if [ "$2" == "yes" ]; then SEQUENCE="true"; else SEQUENCE="false"; fi; shift; shift; continue
                ;;
                --timestamp)
                        if [ "$2" == "yes" ]; then DISABLE_TIMESTAMP="false"; else DISABLE_TIMESTAMP="true"; fi; shift; shift; continue
                ;;
                -a|--jvm-args)
                        EXTRA_JVM_ARGS="$2"; shift; shift; continue
                ;;
                -h|--help)
                        usage
                        exit 0
                ;;            
                -v|--verbose)
                        VERBOSE="1"; shift; continue
                ;;                                                      
                --)                                                                 
                        # no more arguments to parse                                
                        break                                                       
                ;;                                                                  
                *)       
                        # no more arguments to parse                                                                                            
                        break                                                      
                ;;                                                                  
        esac                                                                        
done     

SENDER_ARGS="-server -Durl=$URL \
-Daddress=$ADDRESS \
-Dmsg-count=$MESSAGES \
-Dsend-eos=$SEND_EOS \
-Ddurable=$DURABLE \
-Dmsg_size=$CONTENT_SIZE \
-Dsend-rate=$SEND_RATE \
-Ddisable-timestamp=$DISABLE_TIMESTAMP \
-Dttl=$TTL \
-Dpriority=$PRIORITY \
-Dtx=$TX \
-Drollback-frequnecy=$ROLLBACK_FREQUENCY \
-Dprint-content=$PRINT_CONTENT \
-Dprint-headers=$PRINT_HEADERS \
-Dreport-total=$REPORT_TOTAL \
-Dreport-every=$REPORT_EVERY \
-Dreport-header=$REPORT_HEADER \
-Dmax_prefetch=$CAPACITY "

if [ "x$ID" != "x" ]; then SENDER_ARGS="$SENDER_ARGS -Did=$ID"; fi
if [ "x$USER_ID" != "x" ]; then SENDER_ARGS="$SENDER_ARGS -Duser_id=$USER_ID"; fi
if [ "x$CORRELATION_ID" != "x" ]; then SENDER_ARGS="$SENDER_ARGS -Dcorrelation_id=$CORRELATION_ID"; fi

if [ "$VERBOSE" == "1" ]; then echo $SENDER_ARGS; fi
$JAVA -cp $CLASSPATH $LOG_CONFIG $JAVA_MEM $SENDER_ARGS org.apache.qpid.tools.QpidSend