#!/usr/bin/env python import random import requests from singleton import Singleton """ Communicator module """ __author__ = "@tormakris" __copyright__ = "Copyright 2020, GoldenPogácsa Team" __module_name__ = "messagesender" __version__text__ = "1" class Communicator(Singleton): """ Class handling low level communication with consumers. """ def sendmessage(self, message: str) -> None: """ Send message to consumer. :param message: :return: none """ return None def discoveravailableconsumers(self) -> list: """ Get the list of available consumer from the current primary consumer. :return: """ return ["10.69.42.1","10.42.69.1","10.10.10.10","10.6.66.1"] def isconsumeravailable(self) -> bool: """ Readiness probe primary consumer. :return: """ return bool(random.getrandbits(1)) def checkconsumer(self, consumer: str) -> bool: """ Readiness probe of a prticular consumer. :param consumer: :return: """ return bool(random.getrandbits(1))