37
37
cfg .PortOpt ('udp_port' ,
38
38
default = 4952 ,
39
39
help = 'Port to which the UDP socket is bound.' ),
40
- cfg .BoolOpt ('requeue_sample_on_dispatcher_error' ,
41
- default = False ,
42
- help = 'Requeue the sample on the collector sample queue '
43
- 'when the collector fails to dispatch it. This is only valid '
44
- 'if the sample come from the notifier publisher.' ),
45
- cfg .BoolOpt ('requeue_event_on_dispatcher_error' ,
46
- default = False ,
47
- help = 'Requeue the event on the collector event queue '
48
- 'when the collector fails to dispatch it.' ),
49
40
cfg .IntOpt ('batch_size' ,
50
41
default = 1 ,
51
42
help = 'Number of notification messages to wait before '
@@ -91,8 +82,7 @@ def start(self):
91
82
messaging .get_batch_notification_listener (
92
83
transport , [sample_target ],
93
84
[SampleEndpoint (self .meter_manager )],
94
- allow_requeue = (cfg .CONF .collector .
95
- requeue_sample_on_dispatcher_error ),
85
+ allow_requeue = True ,
96
86
batch_size = cfg .CONF .collector .batch_size ,
97
87
batch_timeout = cfg .CONF .collector .batch_timeout ))
98
88
self .sample_listener .start ()
@@ -104,8 +94,7 @@ def start(self):
104
94
messaging .get_batch_notification_listener (
105
95
transport , [event_target ],
106
96
[EventEndpoint (self .event_manager )],
107
- allow_requeue = (cfg .CONF .collector .
108
- requeue_event_on_dispatcher_error ),
97
+ allow_requeue = True ,
109
98
batch_size = cfg .CONF .collector .batch_size ,
110
99
batch_timeout = cfg .CONF .collector .batch_timeout ))
111
100
self .event_listener .start ()
@@ -158,9 +147,8 @@ def record_metering_data(self, context, data):
158
147
159
148
160
149
class CollectorEndpoint (object ):
161
- def __init__ (self , dispatcher_manager , requeue_on_error ):
150
+ def __init__ (self , dispatcher_manager ):
162
151
self .dispatcher_manager = dispatcher_manager
163
- self .requeue_on_error = requeue_on_error
164
152
165
153
def sample (self , messages ):
166
154
"""RPC endpoint for notification messages
@@ -172,28 +160,16 @@ def sample(self, messages):
172
160
try :
173
161
self .dispatcher_manager .map_method (self .method , samples )
174
162
except Exception :
175
- if self .requeue_on_error :
176
- LOG .exception (_LE ("Dispatcher failed to handle the %s, "
177
- "requeue it." ), self .ep_type )
178
- return oslo_messaging .NotificationResult .REQUEUE
179
- raise
163
+ LOG .exception (_LE ("Dispatcher failed to handle the %s, "
164
+ "requeue it." ), self .ep_type )
165
+ return oslo_messaging .NotificationResult .REQUEUE
180
166
181
167
182
168
class SampleEndpoint (CollectorEndpoint ):
183
169
method = 'record_metering_data'
184
170
ep_type = 'sample'
185
171
186
- def __init__ (self , dispatcher_manager ):
187
- super (SampleEndpoint , self ).__init__ (
188
- dispatcher_manager ,
189
- cfg .CONF .collector .requeue_sample_on_dispatcher_error )
190
-
191
172
192
173
class EventEndpoint (CollectorEndpoint ):
193
174
method = 'record_events'
194
175
ep_type = 'event'
195
-
196
- def __init__ (self , dispatcher_manager ):
197
- super (EventEndpoint , self ).__init__ (
198
- dispatcher_manager ,
199
- cfg .CONF .collector .requeue_event_on_dispatcher_error )
0 commit comments