132
|
1 private import tango.util.log.Configurator;
|
|
2
|
|
3 private import tango.net.cluster.NetworkQueue;
|
|
4
|
|
5 private import tango.net.cluster.tina.Cluster;
|
|
6
|
|
7 /*******************************************************************************
|
|
8
|
|
9 Illustrates how to setup and use a Queue in synchronous mode
|
|
10
|
|
11 *******************************************************************************/
|
|
12
|
|
13 void main ()
|
|
14 {
|
|
15 // join the cluster
|
|
16 auto cluster = (new Cluster).join;
|
|
17
|
|
18 // access a queue of the specified name
|
|
19 auto queue = new NetworkQueue (cluster, "my.queue.channel");
|
|
20
|
|
21 // stuff something into the queue
|
|
22 queue.log.info ("sending three messages to the queue");
|
|
23 queue.put (queue.EmptyMessage);
|
|
24 queue.put (queue.EmptyMessage);
|
|
25 queue.put (queue.EmptyMessage);
|
|
26
|
|
27 // retreive synchronously
|
|
28 while (queue.get)
|
|
29 queue.log.info ("retrieved msg");
|
|
30 }
|