annotate OrthancServer/Resources/Samples/Python/HighPerformanceAutoRouting.py @ 5236:5e0db9eac1f8 db-protobuf

integration mainline->db-protobuf
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Apr 2023 21:43:37 +0200
parents 0ea402b4d901
children 48b8dae6dc77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/usr/bin/python
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
747
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
4 # Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
5 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1184
diff changeset
6 # Department, University Hospital of Liege, Belgium
5185
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4870
diff changeset
7 # Copyright (C) 2017-2023 Osimis S.A., Belgium
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4870
diff changeset
8 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
747
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
9 #
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
10 # This program is free software: you can redistribute it and/or
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
11 # modify it under the terms of the GNU General Public License as
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
12 # published by the Free Software Foundation, either version 3 of the
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
13 # License, or (at your option) any later version.
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
14 #
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
15 # This program is distributed in the hope that it will be useful, but
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
18 # General Public License for more details.
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
19 #
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
20 # You should have received a copy of the GNU General Public License
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
22
44382c8bcd15 added explicit licensing terms for samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
23
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
2032
65b1ce7cb84f Replaced "localhost" by "127.0.0.1", as it might impact performance on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
25 URL = 'http://127.0.0.1:8042'
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 TARGET = 'sample'
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 # This sample code shows how to setup a simple, high-performance DICOM
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 # auto-routing. All the DICOM instances that arrive inside Orthanc
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 # will be sent to a remote modality. A producer-consumer pattern is
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 # used. The target modality is specified by the TARGET variable above:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 # It must match an entry in the Orthanc configuration file inside the
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 # "DicomModalities" section.
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 # NOTE: This sample only works with Orthanc >= 0.5.2. Make sure that
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 # Orthanc was built with "-DCMAKE_BUILD_TYPE=Release" to get the best
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 # performance.
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 import Queue
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 import sys
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 import time
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 import threading
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 import RestToolbox
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 # Queue that is shared between the producer and the consumer
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 # threads. It holds the instances that are still to be sent.
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 queue = Queue.Queue()
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 # The producer thread. It monitors the arrival of new instances into
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 # Orthanc, and pushes their ID into the shared queue. This code is
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 # based upon the "ChangesLoop.py" sample code.
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 def Producer(queue):
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 current = 0
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 while True:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 r = RestToolbox.DoGet(URL + '/changes', {
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 'since' : current,
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 'limit' : 4 # Retrieve at most 4 changes at once
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 })
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 for change in r['Changes']:
3340
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
74 # We are only interested in the arrival of new instances
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 if change['ChangeType'] == 'NewInstance':
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 queue.put(change['ID'])
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 current = r['Last']
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 if r['Done']:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 time.sleep(1)
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 # The consumer thread. It continuously reads the instances from the
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 # queue, and send them to the remote modality. Each time a packet of
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 # instances is sent, a single DICOM connexion is used, hence improving
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 # the performance.
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 def Consumer(queue):
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 TIMEOUT = 0.1
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 while True:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 instances = []
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 while True:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 try:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 # Block for a while, waiting for the arrival of a new
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 # instance
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 instance = queue.get(True, TIMEOUT)
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 # A new instance has arrived: Record its ID
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 instances.append(instance)
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 queue.task_done()
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 except Queue.Empty:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 # Timeout: No more data was received
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 break
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 if len(instances) > 0:
1184
4e9d517503ae port to Python3
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1144
diff changeset
112 print('Sending a packet of %d instances' % len(instances))
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 start = time.time()
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 # Send all the instances with a single DICOM connexion
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 RestToolbox.DoPost('%s/modalities/sample/store' % URL, instances)
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 # Remove all the instances from Orthanc
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 for instance in instances:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 RestToolbox.DoDelete('%s/instances/%s' % (URL, instance))
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
413
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 404
diff changeset
122 # Clear the log of the exported instances (to prevent the
1143
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 747
diff changeset
123 # SQLite database from growing indefinitely). More simply,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 747
diff changeset
124 # you could also set the "LogExportedResources" option to
1144
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1143
diff changeset
125 # "false" in the configuration file since Orthanc 0.8.3.
413
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 404
diff changeset
126 RestToolbox.DoDelete('%s/exports' % URL)
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 404
diff changeset
127
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 end = time.time()
1184
4e9d517503ae port to Python3
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1144
diff changeset
129 print('The packet of %d instances has been sent in %d seconds' % (len(instances), end - start))
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 # Thread to display the progress
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 def PrintProgress(queue):
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 while True:
1184
4e9d517503ae port to Python3
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1144
diff changeset
138 print('Current queue size: %d' % (queue.qsize()))
404
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 time.sleep(1)
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 # Start the various threads
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 progress = threading.Thread(None, PrintProgress, None, (queue, ))
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 progress.daemon = True
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 progress.start()
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 producer = threading.Thread(None, Producer, None, (queue, ))
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 producer.daemon = True
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 producer.start()
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 consumer = threading.Thread(None, Consumer, None, (queue, ))
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 consumer.daemon = True
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 consumer.start()
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 # Active waiting for Ctrl-C
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 #
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 while True:
4b9a7010b1ea sample of routing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 time.sleep(0.1)