def __init__(self, decider: BoboDecider, exchange_name: str, user_id: str, parameters: ConnectionParameters, delay: float, max_sync_attempts: int = 3) -> None: super().__init__() self.parameters = parameters self.outgoing = BoboDistOutgoing(decider=decider, exchange_name=exchange_name, user_id=user_id, parameters=parameters, max_sync_attempts=max_sync_attempts) self.incoming = BoboDistIncoming(outgoing=self.outgoing, decider=decider, exchange_name=exchange_name, user_id=user_id, parameters=parameters) self._incoming_thread = BoboTaskThread(self.incoming, delay) self._outgoing_thread = BoboTaskThread(self.outgoing, delay)
def _config_decider(self) -> None: self._decider = BoboDecider(recursive=self._recursive, max_queue_size=self._max_queue_size, active=(not self._distributed)) self._decider_thread = BoboTaskThread(task=self._decider, delay=self._delay) # Receiver -> Decider self._receiver.subscribe(self._decider)
def _config_forwarder(self) -> None: if self._action_forwarder is None: self._action_forwarder = NoAction() self._forwarder = ActionForwarder(action=self._action_forwarder, max_queue_size=self._max_queue_size, active=(not self._distributed)) self._forwarder_thread = BoboTaskThread(task=self._forwarder, delay=self._delay)
def _config_receiver(self) -> None: if self._validator is None: self._validator = AnyValidator() self._receiver = BoboReceiver(validator=self._validator, formatter=PrimitiveEventFormatter(), max_queue_size=self._max_queue_size, active=(not self._distributed)) self._receiver_thread = BoboTaskThread(task=self._receiver, delay=self._delay) if self._req_null_data: self._null_data_generator = BoboNullDataGenerator( receiver=self._receiver, null_data=self._null_data_obj, active=(not self._distributed)) self._null_event_thread = BoboTaskThread( task=self._null_data_generator, delay=self._null_data_delay)