This repository has been archived by the owner on Jun 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
topic_publish.pal
executable file
·71 lines (62 loc) · 2.69 KB
/
topic_publish.pal
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
<?xml?>
<!--
This pal script sends a series of messages to a topic exchange
and waits for a confirmation from each subscriber that it has
read the entire series. You should tell this script how many
subcribers there are (default = 20).
To use:
scriptname -M messages -S subscribers
The -T option causes the server to set-up a number of topics that
are used for nothing except to load the topic exchange.
-->
<pal script = "amq_pal_gen">
<set name = "messages" value = "1000" cmdline = "M" />
<set name = "subscribers" value = "1" cmdline = "S" />
<set name = "size" value = "500" cmdline = "Z" />
<set name = "settle" value = "0" cmdline = "W" />
<set name = "once" value = "1" cmdline = "O" />
<set name = "topics" value = "0" cmdline = "T" />
<session cluster_key = "my.cluster">
<!-- Create reply queue and start consuming from it -->
<queue_declare exclusive = "1" />
<basic_consume queue = "$queue" />
<!-- Create extra topics to load the topic exchange -->
<repeat times = "$topics" counter = "id">
<basic_content size = "1" />
<basic_publish exchange = "amq.topic" routing_key = "test.topic.$id" />
</repeat>
<repeat>
<!-- Send off our test messages -->
<timer action = "reset" />
<repeat times = "$messages" counter = "id">
<basic_content size = "$size" message_id = "message-$id" reply_to = "$queue" />
<basic_publish exchange = "amq.topic" routing_key = "test" />
</repeat>
<!-- Send off END message -->
<basic_content size = "0" message_id = "END" reply_to = "$queue" />
<basic_publish exchange = "amq.topic" routing_key = "test" />
<!-- Expect confirmations from subscribers -->
<set name = "id" value = "0" />
<repeat>
<wait timeout = "99999" />
<basic_arrived>
<echo>Subscriber $id finished</echo>
<timer action = "show" />
<inc name = "id" />
<if name = "once">
<if name = "id" value = "$subscribers" >
<exit />
</if>
</if>
</basic_arrived>
<empty>
<abort>E: no response from subscriber</abort>
</empty>
</repeat>
<if name = "settle">
<echo>Waiting for $settle msecs...</echo>
<wait timeout = "$settle" />
</if>
</repeat>
</session>
</pal>