Пример #1
0
    def _delete_message_type(self, component: str) -> None:
        """
        Deletes the message type created earlier

        Args:
            component (str): Component name.
        """
        message_type = EVENT_MANAGER_KEYS.MESSAGE_TYPE_VALUE.value.replace(
            "<component_id>", component)
        MessageBus.deregister(message_type)
        # Remove message type key from confstore
        message_type_key = EVENT_MANAGER_KEYS.MESSAGE_TYPE_KEY.value.replace(
            "<component_id>", component)
        if self._confstore.key_exists(message_type_key):
            self._confstore.delete(message_type_key)
        Log.info(
            f"Unsubscribed component {component} from message_type {message_type}"
        )
 def setUp(self):
     """
     Setup.
     """
     self.message_type = "test_ha"
     MessageBus.deregister(self.message_type)
     # Consumer
     self.consumer_id = 1
     self.consumer_group = "test_ha_group"
     # Producer
     producer_id = "ha_producer"
     self.producer = MessageBus.get_producer(producer_id=producer_id,
                                             message_type=self.message_type)
     self.status = None
     self.stop_thread = False
     self.count = 1
     self.consumer = MessageBus.get_consumer(
         consumer_id=self.consumer_id,
         consumer_group=self.consumer_group,
         message_type=self.message_type,
         callback=self._callback)
Пример #3
0
 def cleanup_deregister_all_message_types(self):
     try:
         cluster_stop_message_type = Conf.get(
             const.HA_GLOBAL_INDEX,
             f'CLUSTER_STOP_MON{const._DELIM}message_type')
         MessageBus.deregister(cluster_stop_message_type)
         health_message_type = Conf.get(
             const.HA_GLOBAL_INDEX,
             f'EVENT_MANAGER{const._DELIM}message_type')
         MessageBus.deregister(health_message_type)
         fault_message_type = Conf.get(
             const.HA_GLOBAL_INDEX,
             f'FAULT_TOLERANCE{const._DELIM}message_type')
         MessageBus.deregister(fault_message_type)
     except Exception as ex:
         print(f"Exeception during derigister all messages: {ex}")
 def tearDown(self):
     """
     destroy.
     """
     MessageBus.deregister(self.message_type)