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
/
Copy pathecho_server.pal
47 lines (42 loc) · 1.75 KB
/
echo_server.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
<?xml?>
<pal script = "amq_pal_gen">
This script echoes back arbitrary messages sent to the "echo server"
routing key. See echo_client.pal for usage.
<!-- Quit after having received this number of messages,
0=disable -->
<set name = "count" value = "10000" cmdline = "C" />
<!-- Log number of messages sent/received every N messages,
0=disable -->
<set name = "log_interval" value = "0" cmdline = "L" />
<set name = "received" value = "0" />
<set name = "total_received" value = "0" />
<if name = "count" test = "ne" value = "0" >
<echo>I: Waiting for $count messages ...</echo>
</if>
<session exchange = "amq.direct">
<queue_declare auto_delete = "1" />
<queue_bind queue = "$queue" routing_key = "echo server" />
<basic_consume queue = "$queue" auto_ack = "1" />
<repeat>
<wait />
<basic_arrived>
<if name = "total_received" value = "0" >
<timer />
</if>
<inc name = "total_received" />
<if name = "log_interval" test = "ne" value = "0" >
<inc name = "received" />
<if name = "received" value = "log_interval" >
<echo>I: Received $total_received messages</echo>
<set name = "received" value = "0" />
</if>
</if>
<basic_publish routing_key = "$reply_to" />
<if name = "total_received" value = "count" >
<echo>I: Received all messages</echo>
<exit />
</if>
</basic_arrived>
</repeat>
</session>
</pal>