Merge remote-tracking branch 'origin/master'
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -6,4 +6,4 @@ COPY . ./
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
RUN pip3 install --no-cache-dir -r requirements.txt
 | 
					RUN pip3 install --no-cache-dir -r requirements.txt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CMD ["python3" "app.py"]
 | 
					CMD ["python3", "app.py"]
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								MessageSender.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								MessageSender.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env python
 | 
				
			||||||
 | 
					import sentry_sdk
 | 
				
			||||||
 | 
					import json
 | 
				
			||||||
 | 
					import random
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class MessageSender:
 | 
				
			||||||
 | 
					    data = {
 | 
				
			||||||
 | 
					        "packet name" : "name",
 | 
				
			||||||
 | 
					        "data" : random.randrange(100000)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    message = json.dumps(data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 | 
					    print("Producer")
 | 
				
			||||||
 | 
					    message = MessageSender()
 | 
				
			||||||
 | 
					    print(message.message)
 | 
				
			||||||
							
								
								
									
										44
									
								
								communicator.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								communicator.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env python
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import requests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"""
 | 
				
			||||||
 | 
					Main Flask RESTful API
 | 
				
			||||||
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__author__ = "@tormakris"
 | 
				
			||||||
 | 
					__copyright__ = "Copyright 2020, GoldenPogácsa Team"
 | 
				
			||||||
 | 
					__module_name__ = "messagesender"
 | 
				
			||||||
 | 
					__version__text__ = "1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Communicator:
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    Class handling low level communication with consumers.
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    def __init__(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Initalize class
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def sendmessage(self, message: str) -> None:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Send message to consumer.
 | 
				
			||||||
 | 
					        :param message:
 | 
				
			||||||
 | 
					        :return: none
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def discoveravailableconsumers(self) -> list:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Get the list of available consumer from the current primary consumer.
 | 
				
			||||||
 | 
					        :return:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def isconsumeravailable(self) -> bool:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Readiness probe primary consumer.
 | 
				
			||||||
 | 
					        :return:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        pass
 | 
				
			||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#IDE JÖNNEK IMPORTOK
 | 
					# IDE JÖNNEK IMPORTOK
 | 
				
			||||||
 | 
					import random
 | 
				
			||||||
 | 
					import string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
Main Flask RESTful API
 | 
					Main Flask RESTful API
 | 
				
			||||||
@@ -15,17 +17,37 @@ class MessageSender:
 | 
				
			|||||||
    """
 | 
					    """
 | 
				
			||||||
    Üzenetek küldéséért felelős komponens.
 | 
					    Üzenetek küldéséért felelős komponens.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					    id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self):
 | 
					    def __init__(self):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Inicializálja az osztályt.
 | 
					        Inicializálja az osztályt.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					        self.id = 0
 | 
				
			||||||
        pass
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def cucc(self, szam: int, szoveg: str) -> str:
 | 
					
 | 
				
			||||||
 | 
					    def randomString(self, stringLength):
 | 
				
			||||||
 | 
					        """Generate a random string of fixed length """
 | 
				
			||||||
 | 
					        letters = string.ascii_lowercase
 | 
				
			||||||
 | 
					        return ''.join(random.choice(letters) for i in range(stringLength))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def CreateMessage(self, p) -> str:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Ez egy metodus
 | 
					        Ez egy metodus
 | 
				
			||||||
        :param szam:
 | 
					        :param szam:
 | 
				
			||||||
        :param szoveg:
 | 
					        :param szoveg:
 | 
				
			||||||
        :return: str tipus
 | 
					        :return: str tipus
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					        self.id += random.randrange(10000)
 | 
				
			||||||
 | 
					        data = self.randomString(p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #print(str(self.id) + " " + str(data))
 | 
				
			||||||
 | 
					        return str(self.id) + " " + str(data)
 | 
				
			||||||
        pass
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 | 
					    temp = MessageSender()
 | 
				
			||||||
 | 
					    print(temp.CreateMessage(20))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1,2 @@
 | 
				
			|||||||
sentry_sdk
 | 
					sentry_sdk
 | 
				
			||||||
 | 
					requests
 | 
				
			||||||
		Reference in New Issue
	
	Block a user