| 1 |
#!/usr/bin/env regina |
| 2 |
/* |
| 3 |
* External queues are identified by '@' in the queue name. MYQ@ is a queue available on the local |
| 4 |
* machine with rxstack listening on the default port: 5757 |
| 5 |
* |
| 6 |
*/ |
| 7 |
Parse Arg action |
| 8 |
If action = 'send' Then Call RunSender |
| 9 |
Else Call RunReceiver |
| 10 |
Return 0 |
| 11 |
|
| 12 |
RunSender: Procedure |
| 13 |
Call RxQueue 'S', 'MYQ@' -- set our queue to MYQ@ |
| 14 |
Do i = 1 To 10 |
| 15 |
line = 'line'i |
| 16 |
Queue line |
| 17 |
Say 'Queued:' line |
| 18 |
End |
| 19 |
Queue 'quit' |
| 20 |
Say 'Queued:' 'quit' |
| 21 |
Return |
| 22 |
|
| 23 |
RunReceiver: Procedure |
| 24 |
Call RxQueue 'C', 'MYQ@' -- create MYQ on the local machine |
| 25 |
Call RxQueue 'S', 'MYQ@' -- set our queue to MYQ@ |
| 26 |
Call RxQueue 'T', 0 -- set the timeout on the current queue to 0 (wait indefinitely) |
| 27 |
Do Forever |
| 28 |
Parse Pull line |
| 29 |
Say 'Received:' line |
| 30 |
If line = 'quit' Then Leave |
| 31 |
End |
| 32 |
Call RxQueue 'D', 'MYQ@' -- delete MYQ |
| 33 |
Return |