def __init__(self, host="", reconnectionTimer=reconnectiontimers.CreateLogarithmicTimer(), maxReconnections=Channel.MAX_RECONNECTIONS, compressor=compressors.DefaultCompressor(), useAck=False): Channel.__init__(self, host, reconnectionTimer, maxReconnections, compressor, useAck) Startable.__init__(self) self._thReceive = threading.Thread(target=self.__workReceive) self.OnMessageReceived = EventHook() self.OnStart += self.__beginReceive self.OnStopped += self.__endReceive
def __init__(self, queue, channels=list(), numExtractors=4): Startable.__init__(self) self._channels = list() self._queue = queue self.OnConnectionError = EventHook() for channel in channels: self.addChannel(channel) self._thExtractors = list() for count in range(0, numExtractors): self._thExtractors.append(threading.Thread(target=self._process_queue))
def __init__(self, queue, channels=list(), numExtractors=4): Startable.__init__(self) self._channels = list() self._queue = queue self.OnConnectionError = EventHook() for channel in channels: self.addChannel(channel) self._thExtractors = list() for count in range(0, numExtractors): self._thExtractors.append( threading.Thread(target=self._process_queue))
def __del__(self): Startable.__del__(self) for channel in self._channels: del channel self.OnConnectionError.clear()
def _invokeOnStopped(self): Startable._invokeOnStopped(self) for th in self._thExtractors: th.join()
def _invokeOnStart(self): Startable._invokeOnStart(self) for th in self._thExtractors: th.start()