This commit is contained in:
parent
de64ef0e41
commit
65db908fb6
@ -35,8 +35,9 @@ class Communicator:
|
|||||||
:return: none
|
:return: none
|
||||||
"""
|
"""
|
||||||
currentconsumer=self.currenctconsumer
|
currentconsumer=self.currenctconsumer
|
||||||
LOGGER.debug(f"Sending message to {currentconsumer}")
|
LOGGER.info(f"Sending message to {currentconsumer}")
|
||||||
requests.post(f'http://{currentconsumer}/log', json={'uuid': self.uuid, 'message': message})
|
postresponse=requests.post(f'http://{currentconsumer}/log', json={'uuid': self.uuid, 'message': message})
|
||||||
|
LOGGER.debug(f"Message status code is:{postresponse.status_code}")
|
||||||
|
|
||||||
def discoveravailableconsumers(self) -> list:
|
def discoveravailableconsumers(self) -> list:
|
||||||
"""
|
"""
|
||||||
@ -47,7 +48,7 @@ class Communicator:
|
|||||||
currentconsumer = self.currenctconsumer
|
currentconsumer = self.currenctconsumer
|
||||||
response = requests.get(f'http://{currentconsumer}/consumer')
|
response = requests.get(f'http://{currentconsumer}/consumer')
|
||||||
json = response.json()
|
json = response.json()
|
||||||
LOGGER.debug(f"List of currently available consumers: {json}")
|
LOGGER.info(f"List of currently available consumers: {json}")
|
||||||
return json
|
return json
|
||||||
except Exception:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
@ -64,7 +65,7 @@ class Communicator:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOGGER.exception(e)
|
LOGGER.exception(e)
|
||||||
isavailable = False
|
isavailable = False
|
||||||
LOGGER.debug(f"Current consumer availability: {isavailable}")
|
LOGGER.info(f"Current consumer availability: {isavailable}")
|
||||||
return isavailable
|
return isavailable
|
||||||
|
|
||||||
def checkconsumer(self, consumer: str) -> bool:
|
def checkconsumer(self, consumer: str) -> bool:
|
||||||
@ -79,7 +80,7 @@ class Communicator:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOGGER.exception(e)
|
LOGGER.exception(e)
|
||||||
isavailable = False
|
isavailable = False
|
||||||
LOGGER.debug(f"Consumer {consumer} availability: {isavailable}")
|
LOGGER.info(f"Consumer {consumer} availability: {isavailable}")
|
||||||
return isavailable
|
return isavailable
|
||||||
|
|
||||||
def set_currentconsumer(self,currenctconsumer):
|
def set_currentconsumer(self,currenctconsumer):
|
||||||
|
Reference in New Issue
Block a user