-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
315 lines (274 loc) · 12.5 KB
/
build.xml
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project name="Inbox" default="help" basedir=".">
<property name="class.dir" value="target/classes" />
<property name="activemq.home" value=".." />
<!-- example program defaults -->
<property name="url" value="tcp://localhost:61616" />
<property name="topic" value="false" />
<property name="subject" value="TEST.FOO" />
<property name="durable" value="false" />
<property name="max" value="2000" />
<property name="parallelThreads" value="1" />
<property name="messageSize" value="1000" />
<property name="clientId" value="consumer1" />
<property name="producerClientId" value="null" />
<property name="timeToLive" value="0" />
<property name="sleepTime" value="0" />
<property name="transacted" value="false" />
<property name="reply-subject" value="" />
<property name="verbose" value="true"/>
<property name="ack-mode" value="AUTO_ACKNOWLEDGE"/>
<property name="receive-time-out" value="0"/>
<property name="subscribers" value="1"/>
<property name="batch" value="10"/>
<!-- for WAR -->
<property name="app.name" value="activemq-web" />
<property name="app.base.dir" location="target/${app.name}" />
<property name="app.webinf.dir" value="${app.base.dir}/WEB-INF" />
<property name="app.classes.dir" value="${app.webinf.dir}/classes" />
<property name="app.lib.dir" value="${app.webinf.dir}/lib" />
<property name="app.src.dir" value="src" />
<property name="app.conf.dir" value="conf" />
<property name="app.dist.dir" value="target" />
<target name="help">
<echo>
This script requires Ant 1.6 or higher
NOTE: All options should be specified as system properties
on the command line, e.g.:
ant consumer -Durl=tcp://hostname:1234 -Dtopic=true
OR
ant producer -Durl=tcp://hostname:61616 -Dmax=1000
Usage:
ant <ant-task> <options>
--------------------------------------------------------
ant consumer <options> - Creates a consumer which waits until a specific number
of messages have been received
Consumer Options:
url - Used to specify acustom URL for the
broker, e.g., tcp://hostname:1234
topic - A boolean to determine whether to use
topics or queues; the default is false
subject - Used to specify a custom destination
name, e.g. MyDestination
durable - A boolean to specify that you want to
create a durable topic?
max - The maximum number of messages to wait
for before shutting down
clientId - A string to use as the client id
transacted - A boolean to specify that you want to use
transactions?
sleepTime - The time to sleep between message consumptions
verbose - Used to print out more info; the default is
true
ack-mode - The type of message acknowledgement to use;
see the Javadocs for javax.jms.Session for
more information
receive-time-out - An integer to specify the time to wait for
message consumption
parallelThreads - The number of parallel threads
--------------------------------------------------------
ant producer <options> - Creates a producer publishing a number of messages
Producer Options:
url - Used to specify acustom URL for the broker,
e.g., tcp://hostname:1234
topic - A boolean to determine whether to use topics
or queues
subject - Used to specify a custom destination name,
e.g. MyDestination
durable - A boolean to specify that you want to create
a durable topic subscriber?
max - The maximum number of messages to wait for
before shutting down
sleepTime - The time to sleep between message consumptions
transacted - A boolean to specify that you want to use
transactions?
verbose - Used to print out more info; the default is true
messageSize - The size of the message in 1-byte characters
parallelThreads - The number of parallel threads
--------------------------------------------------------
ant -help - Display ant help screen
ant help - Display this message
ant clean - Delete the built directory
ant embedBroker - Runs an embedded broker inside Java code
ant war - Creates a WAR deployment unit of the ActiveMQ Broker
</echo>
</target>
<target name="clean">
<delete dir="target" quiet="true" />
<delete dir="${class.dir}" quiet="true" />
</target>
<target name="init">
<mkdir dir="${class.dir}" />
<mkdir dir="src/ddl" />
<path id="javac.classpath">
<pathelement path="${class.dir}" />
<pathelement path="conf" />
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="compile" depends="init" description="Compile all Java">
<javac srcdir="src" destdir="${class.dir}">
<classpath refid="javac.classpath" />
</javac>
<copy todir="${class.dir}">
<fileset dir="src">
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</copy>
</target>
<target name="war" depends="compile" description="Create the activemq broker war file.">
<!--Copy the required jar files-->
<copy todir="${app.lib.dir}">
<fileset dir="lib">
<include name="*.jar" />
<exclude name="servlet.jar" />
</fileset>
<fileset dir="lib/optional">
<include name="activemq-web*.jar" />
<include name="activemq-container*.jar" />
<include name="commons-bean*.jar" />
<include name="spring*.jar" />
<include name="xbean*.jar" />
<!-- include Apache Derby for persistence -->
<include name="derby*.jar" />
<!-- include database pooling just in case -->
<include name="commons-pool*.jar" />
<include name="commons-db*.jar" />
</fileset>
</copy>
<!--Copy the configuration file-->
<copy todir="${app.webinf.dir}">
<fileset dir="${app.conf.dir}">
<!--Web application configuration file-->
<include name="web.xml" />
<!--ActiveMQ configuration file-->
<include name="activemq.xml" />
</fileset>
</copy>
<copy todir="${app.classes.dir}">
<fileset dir="${app.conf.dir}">
<!--Log4j configuration file-->
<include name="log4j.properties" />
</fileset>
</copy>
<!-- Create the war file -->
<jar jarfile="${app.dist.dir}/${app.name}.war" basedir="${app.base.dir}" />
</target>
<target name="consumer" depends="compile" description="Runs a simple consumer">
<echo>Running consumer against server at $$url = ${url} for subject $$subject = ${subject}</echo>
<java classname="ConsumerTool" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-server" />
<sysproperty key="activemq.home" value="${activemq.home}"/>
<arg value="--url=${url}" />
<arg value="--topic=${topic}" />
<arg value="--subject=${subject}" />
<arg value="--durable=${durable}" />
<arg value="--maxium-messages=${max}" />
<arg value="--client-id=${clientId}" />
<arg value="--parallel-threads=${parallelThreads}" />
<arg value="--transacted=${transacted}" />
<arg value="--sleep-time=${sleepTime}" />
<arg value="--verbose=${verbose}"/>
<arg value="--ack-mode=${ack-mode}"/>
<arg value="--receive-time-out=${receive-time-out}"/>
</java>
</target>
<target name="producer" depends="compile" description="Runs a simple producer">
<echo>Running producer against server at $$url = ${url} for subject $$subject = ${subject}</echo>
<java classname="ProducerTool" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-server" />
<sysproperty key="activemq.home" value="${activemq.home}"/>
<arg value="--url=${url}" />
<arg value="--topic=${topic}" />
<arg value="--subject=${subject}" />
<arg value="--persistent=${durable}" />
<arg value="--message-count=${max}" />
<arg value="--message-size=${messageSize}" />
<arg value="--parallel-threads=${parallelThreads}" />
<arg value="--time-to-live=${timeToLive}" />
<arg value="--sleep-time=${sleepTime}" />
<arg value="--transacted=${transacted}" />
<arg value="--verbose=${verbose}"/>
</java>
</target>
<target name="requester" depends="compile" description="Runs a simple requester">
<echo>Running requester against server at $$url = ${url} for subject $$subject = ${subject}</echo>
<java classname="RequesterTool" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-server" />
<sysproperty key="activemq.home" value="${activemq.home}"/>
<arg value="--url=${url}" />
<arg value="--topic=${topic}" />
<arg value="--subject=${subject}" />
<arg value="--persistent=${durable}" />
<arg value="--message-count=${max}" />
<arg value="--message-size=${messageSize}" />
<arg value="--client-id=${producerClientId}" />
<arg value="--time-to-live=${timeToLive}" />
<arg value="--sleep-time=${sleepTime}" />
<arg value="--transacted=${transacted}" />
<arg value="--reply-subject=${reply-subject}" />
<arg value="--verbose=${verbose}"/>
</java>
</target>
<target name="embedBroker" depends="compile" description="Runs a simple producer">
<echo>Running an embedded broker example</echo>
<java classname="EmbeddedBroker" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-server" />
<sysproperty key="activemq.home" value="${activemq.home}"/>
</java>
</target>
<target name="topic-publisher" depends="compile" description="Runs a publisher">
<java classname="TopicPublisher" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-server" />
<arg value="--url=${url}" />
<arg value="--size=${messageSize}" />
<arg value="--subscribers=${subscribers}" />
<arg value="--messages=${max}" />
<arg value="--delay=${sleepTime}" />
<arg value="--batch=${batch}" />
</java>
</target>
<target name="topic-listener" depends="compile" description="Runs a listener">
<java classname="TopicListener" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-server" />
<arg value="--url=${url}" />
</java>
</target>
<target name="stomp" depends="compile" description="Runs a Stomp example">
<echo>Running a Stomp example</echo>
<java classname="StompExample" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-server" />
</java>
</target>
<target name="log4j-jms" depends="compile" description="Runs a Log4j JMS Appender example">
<echo>Running a Log4j JMS Appender example</echo>
<java classname="Log4jJMSAppenderExample" fork="yes" maxmemory="100M">
<classpath refid="javac.classpath" />
<jvmarg value="-Dlog4j.configuration=log4j-jms.properties" />
</java>
</target>
</project>